All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
A Quicky II (Posted on 2014-04-03) Difficulty: 1 of 5
For a given n what is the smallest number greater than n, not a multiple of n, but containing n in its binary representation?

Answer within 30 sec.

No Solution Yet Submitted by Ady TZIDON    
No Rating

Comments: ( Back to comment list | You must be logged in to post comments.)
Some Thoughts re(2): Clarification? | Comment 3 of 7 |
(In reply to re: Clarification? by Ady TZIDON)

Well I suppose it would be the binary representation of (2n+1), but only for those cases where the binary representation of n is divisible by n, otherwise the answer is just the binary representation of n.

Let bin(n) be the decimal number formed by the binary representation of n.

For example, for n = 2, bin(n) = 10.  The smallest number that contains the digits "10" and isn't divisible by 2 is 101, which is the binary representation of 5, which is 2(2) + 1.

On the other hand, for n = 3, bin(n) = 11.  11 is greater than 3, isn't divisible by 3, and contains the digits "11", so that's the solution.

The values n for which bin(n) = 0 mod n are 2, 4, 8, 10, 16, 20, 21, 32, 40, 42, 64, 80, 84, 100, 128, 160, 168, 200, 256, 273...

I don't immediately see any pattern there that would lead to a closed-form solution to your problem for all n.


  Posted by tomarken on 2014-04-03 10:33:09
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (8)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2017 by Animus Pactum Consulting. All rights reserved. Privacy Information