Brain games: puzzles, riddles, and logical games.
Users rating Registration FAQ

Puzzles, riddles, logical games, mathematics

www.puzzlesriddles.com on Facebook
 

 
Login:
Password:
Remember?
Change password



1. pretorik - 161
2. markr - 116
3. Gordon Weir - 104
4. mbloomfi - 97
5. Dennis Nazarov - 96
6. zzz123 - 72
7. Srikanta - 56
8. lidSpelunker - 53
9. SAMIH FAHMY - 48
10. jkr - 44


1. denisR, mishik - 236
2. alan, De_Bill - 231
3. dddfff - 228
4. kavfy - 221
5. idler_ - 106
6. akajobe - 94
7. tolstyi - 56
8. STARuK - 42
9. vale - 31
10. xandr - 11



A power of 2 Puzzles for programmers  Weight: 0 Liked the puzzle: 100% 06.01.2010
A positive integer is given. How can you determine whether it is a power of 2 without using recursion and floating point operations?
Comments:   8 check your solution  

Please do not post comments containing clues, hints, or anything that might be considered as a hint to others. All such comments will be deleted. If you have a question, you can contact a moderator by clicking the button "Submit your solution".

idler_
 
Rating: 106
Group: Moderators
äîáàâëåí 2011-01-28 19:42:22
Reserved.
lidSpelunker
 
Rating: 53
Group: Members
äîáàâëåí 2011-02-15 20:02:43
Is iteration permitted?(e.g. for loops, while loops etc.)
alan
 
Rating: 231
Group: Moderators
äîáàâëåí 2011-02-21 00:01:57
lidSpelunker 2011-02-15 20:02:43
Is iteration permitted?(e.g. for loops, while loops etc.)

No.
zzz123
 
Rating: 72
Group: Members
äîáàâëåí 2011-03-20 18:17:47
what operations ARE allowed, exactly?
alan
 
Rating: 231
Group: Moderators
äîáàâëåí 2011-03-21 12:56:31
Any operations of C++, for example. Except loops and function calls.
zzz123
 
Rating: 72
Group: Members
äîáàâëåí 2011-03-23 03:46:05
is this a positive integer in the mathematical sense or the programmer sense? (e.g. is it capped at some number of bits, or is a 6-trillion-digit number considered valid input)
alan
 
Rating: 231
Group: Moderators
äîáàâëåí 2011-03-23 08:28:17
zzz123 2011-03-23 03:46:05
is this a positive integer in the mathematical sense or the programmer sense? (e.g. is it capped at some number of bits, or is a 6-trillion-digit number considered valid input)

You don't know number of bits anyway.
Muzza
 
Rating: 15
Group: Members
äîáàâëåí 2011-03-24 05:19:40
it is very easy to obtain number of bits in C++ without using loops



 
Users online 0: administrator -  administrator  moderator -  moderator  VIP user -  VIP user  user -  user
en.braingames.ru © 2006-2010 All Rights Reserved