+ 129

⚠️Challenge: how many odious numbers smaller than 10.000 can you find⚠️

odious numbers are non-negative numbers that have an odd number of ones in the binary expansion # 21 = 10101 = 3 # 50 = 110010 = 3 Challenge: how many odious numbers smaller than 10000 can you find? edit: first of all, thanks to everyone for the massive response!! And of course thanks to Sololearn for making my first post ever COTD! Now, the answer is indeed: 5000. the solution is in fact quite simple: https://code.sololearn.com/cSURNat0z4aN/#rb ------------------------------------------------- WALL OF FAME (sorry if I missed yours) ------------------------------------------------- Phython https://code.sololearn.com/cTYPIZDj3jAe C# https://code.sololearn.com/cSMFtFx0ppSE/ Java https://code.sololearn.com/cY4Q8IWoXED7/ Ruby https://code.sololearn.com/cBS3MX4AJ5AG/ (ONELINER!) C https://code.sololearn.com/csYPoI3aYW3Z#c (ASSEMBLER!) C++ https://code.sololearn.com/chPjNwhxSn9G/ Python https://code.sololearn.com/cX4YOhrrwTT4/ Python https://code.sololearn.com/cypCqoU0rX (ONELINER!) PHP https://code.sololearn.com/wtNdvjh16Ac9/ C++ https://code.sololearn.com/cAgm43t2SjAp/ PHP https://code.sololearn.com/wtHvYfDAoc1d/ C# https://code.sololearn.com/cT4V6XIp87AV/ (ONELINER!) Python https://code.sololearn.com/c5jF395sA9hZ Javascript https://code.sololearn.com/W3hRTRmTmctd/ Java https://code.sololearn.com/cliBAk1pL59h/ C# https://code.sololearn.com/cTR605gBHs6H/ (PURE MATHS!) C# https://code.sololearn.com/ccMSQT42vXXd/ Python https://code.sololearn.com/c5LP4b4H85ra/ (MATH) Web https://code.sololearn.com/WN8491v4583Q/ C++ https://code.sololearn.com/c8F2EP6kdIK0/ (FLOAT) Web https://code.sololearn.com/WN7olfJj5VH4/ C++ https://code.sololearn.com/cbU813A6sLeC/

11th Dec 2017, 8:17 PM
bedawang
bedawang - avatar
192 Respostas
+ 57
Here's onliner code 😊 Ruby is awesome 🤓 https://code.sololearn.com/cBS3MX4AJ5AG/?ref=app
9th Dec 2017, 6:33 PM
LukArToDo
LukArToDo - avatar
+ 47
I will attempt this tomorrow my friend. Edit: Here it is: https://code.sololearn.com/cWUr9TunveUH/?ref=app
9th Dec 2017, 3:38 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 25
print(len([j for j in range(10001) if str(bin(j)).count('1')&1])) #One liner in Python
10th Dec 2017, 4:59 AM
Kartikey Sahu
Kartikey Sahu - avatar
9th Dec 2017, 4:35 PM
LukArToDo
LukArToDo - avatar
+ 20
5000 numbers are odious, which are less than 10000 https://code.sololearn.com/c7J6dwv5xs7r/?ref=app
9th Dec 2017, 3:45 PM
Cool Codin
Cool Codin - avatar
+ 19
Done : https://code.sololearn.com/cGd90xz6jql2/?ref=app Due to limitations of sololearn app , the limit can exceed a certain number . So it stops by showing : time limit exceeded EDIT : Displayed the number of numbers odius between 0 to 10000
9th Dec 2017, 3:42 PM
RZK 022
RZK 022 - avatar
10th Dec 2017, 11:31 AM
Käzî Mrîdùl Høssäîn
Käzî Mrîdùl Høssäîn - avatar
+ 13
Made this till now.. Will complete it tomorrow😴 https://code.sololearn.com/cn5oFwDUZWx4/?ref=app
9th Dec 2017, 5:45 PM
Yash✳️
Yash✳️ - avatar
10th Dec 2017, 6:10 PM
Said BAHAOUARY
Said BAHAOUARY - avatar
11th Dec 2017, 8:50 AM
Abhishek Tandon
Abhishek Tandon - avatar
11th Dec 2017, 9:33 PM
Justine Ogaraku
Justine Ogaraku - avatar
9th Dec 2017, 6:18 PM
MuzzRK
MuzzRK - avatar
+ 9
https://code.sololearn.com/cY4Q8IWoXED7/?ref=app
9th Dec 2017, 6:25 PM
...
+ 9
5000, not 5001 (SMALLER then 10000, without 10000)
10th Dec 2017, 3:34 PM
Контари
+ 9
My solution in JAVA Answer : 5000 https://code.sololearn.com/cY6xgEqT8fJ6/?ref=app
10th Dec 2017, 3:58 PM
Jain Rishav Amit
Jain Rishav Amit - avatar
10th Dec 2017, 4:42 PM
Freezemage
Freezemage - avatar
+ 9
@kartikey sahu Niceeeeeee one liner
10th Dec 2017, 5:05 PM
Yash✳️
Yash✳️ - avatar
10th Dec 2017, 5:38 PM
Marfik Em
Marfik Em - avatar
10th Dec 2017, 7:10 AM
Ferhat Sevim
Ferhat Sevim - avatar
10th Dec 2017, 3:37 PM
Kartik
Kartik - avatar