What is the smallest positive multiple of 450 whose digits are all zeroes and ones?

I tried guess and check but the numbers grew big fast. Thanks in advance!

Martin Sleziak
  • 50,316
  • 18
  • 169
  • 342
  • 1,267
  • 1
  • 10
  • 25
  • 20
    I would love to know how you came up with this question... – Cronus Aug 25 '16 at 20:45
  • 2
    @Cronus I'm currently taking a Number Theory class and the teacher thought it would be fun if all the students came up with their own problems to solve. I have seen similar problems to this question, that's how I came up with it. Thanks for asking! – Dreamer Aug 25 '16 at 21:40
  • 2
    @Cronus I have no idea where it *first* arose, but I recall seeing it some years ago in a list of job interview questions. Jane Street asked it as linked [here](http://www.cbsnews.com/news/20-craziest-job-interview-questions-and-the-right-answers/) for 225 (which is half of 450, and doesn't really change matters: the same reasoning goes through). – Benjamin Dickman Aug 25 '16 at 22:27
  • @BenjaminDickman haha, awesome. Thanks for sharing:] – Cronus Aug 25 '16 at 22:50
  • 6
    There are possible smartass answers, too, but I can't think of any really good ones. +0 (meh, debatable), +0.00...1 (it didn't say *integer* multiple!) and "450 in binary" (bleh). – Dewi Morgan Aug 26 '16 at 02:55
  • @Regina If you did come up with this question, I would love to know how did you know if there is a solution. Were you able to prove that somehow before you started looking for a solution? Otherwise, you were just shooting in the dark? – Fixed Point Aug 26 '16 at 05:56
  • The answer is 450. What? Did you not want the answer given in base 2? – A Simmons Aug 26 '16 at 13:23
  • @FixedPoint I randomly chose a number, 450. I had my instructor look at it and she said that there was a solution. – Dreamer Aug 26 '16 at 16:07
  • Fun fact: there is always a solution (though in many cases it will be harder to find). – Micah Aug 26 '16 at 17:17
  • @Micah How is that true? – Fixed Point Aug 26 '16 at 20:01
  • 5
    @FixedPoint: Any integer has a multiple of the form $9\dots90\dots0$ (because its reciprocal has a repeating decimal expansion, or by Euler's totient theorem, [whichever you like](http://math.stackexchange.com/questions/204645/why-directly-does-every-number-divide-9-99-999-or-10-100-1000/204653#204653)). In particular, given any integer $x$, $9x$ has such a multiple... – Micah Aug 26 '16 at 20:47
  • @Dewi, it could be argued that `0` is *not* a number whose "digits are all zeroes ***and*** ones". –  Aug 27 '16 at 06:23
  • @paxdiablo: with a phrasing like “…such that 0 and 1 the only digits appearing in it”, you could make a case for excluding 0. But the phrasing “its digits are all 0s and 1s” is pretty unabgiguously a *universally* quantified statement about the digits, and as such, must remain valid under removing digits — so 0 definitely qualifies. Indeed, one could take the intentionally perverse reading “each of its digits is 0 and 1”, under which 0 is the *only* number that qualifies — since it can be represented by the empty string of digits! – Peter LeFanu Lumsdaine Aug 27 '16 at 19:00
  • 3
    After reading comments by @Micah, I looked the sequence up: [A004290: Least positive multiple of n that when written in base 10 uses only 0's and 1's.](http://oeis.org/A004290) – Jeppe Stig Nielsen Aug 28 '16 at 09:36
  • ... and the related sequence [A079339](http://oeis.org/A079339) there gives a concise version of the proof. Quote: _This sequence is well defined. In the n+1 first repunits (see [A002275](http://oeis.org/A002275)), there are at least 2 numbers that have the same value modulo n ([Pigeonhole principle](https://en.wikipedia.org/wiki/Pigeonhole_principle)). The difference between those two numbers contains only 1's and 0's in decimal representation._ – Jeppe Stig Nielsen Aug 28 '16 at 09:51
  • @JeppeStigNielsen See also [**MSE 1591588**](http://math.stackexchange.com/q/1591588). – Benjamin Dickman Aug 30 '16 at 00:30
  • The question has at the moment four close votes with the close reason *missing context* or *unclear what you are asking*. If it is put on hold, the next edit following closure puts your post in the review queue, where users can vote whether to reopen it or leave it closed. @Regina [This link](http://meta.math.stackexchange.com/a/9960) might be useful if you want to know what things can be added to provide context. (For example, the link from Benjamin Dickman's comment might be worth adding.) – Martin Sleziak Sep 02 '16 at 11:08
  • I will also mention that voting to close this question as unclear seems a bit strange to me. I can understand the close vote where the votes chose missing context as the close-reason. – Martin Sleziak Sep 02 '16 at 11:09

5 Answers5


Can we agree that it must be an even multiple of 450? Otherwise the last two digits will be 50.

What is the smallest positive multiple of 900 such that all the digits are 0s or 1s?

A rule of multiples of 9: the sum of the digits of a multiple of 9 is a multiple of 9.

This rule goes both ways. If the sum of the digits is a multiple of 9, the number is a multiple of 9.

That makes 11111111100 our winner.

Doug M
  • 56,854
  • 4
  • 30
  • 63
  • 16
    It might be good to clarify that by even you mean that the number is of the form $450k$ where $k$ is even. – filipos Aug 25 '16 at 18:46
  • Something along the lines of "This is thus the smallest possible candidate and a trial division shows, that it is actually a multiple of 450" would be nice to complete the argument. – example Aug 26 '16 at 23:08
  • 13
    @example, it's unnecessary. See the penultimate sentence. The rule goes both ways. Therefore, *without* trial division, we know that 11111111100 is divisible by 9, and by the final two 0 digits we know it is divisible by 100. – Wildcard Aug 26 '16 at 23:29

Write the answer N as $450k$. To ensure that the tens place is either one or zero, we require $k$ to be even. Therefore N is a multiple of 900. Because any multiple of 900 must have its last two digits zero, we can ignore the tens and units places and reduce the question to:

What is the smallest multiple of 9 with all digits 0 or 1?

A number is divisible by 9 if and only if the sum of its digits is a multiple of 9. But we are restricted to ones and zeros, so the smallest multiple of 9 that can be formed is nine ones: $111{,}111{,}111$.

Hence the answer to your question is this number with the two zeros tacked back on at the end: $$11{,}111{,}111{,}100=450\times24{,}691{,}358$$ (I have added grouping commas for clarity.)

  • 109
  • 2
Parcly Taxel
  • 89,705
  • 18
  • 102
  • 171

A short Python script to solve this.



while 1:
    # Convert number to text string
    strX = str(x) 

    # Check if the number of 0's and 1's equal the total length of the string
    if strX.count("0") + strX.count("1") == len(strX):
        print "Found it:", strX

    # Add another 450


Found it: 11111111100
  • 107
  • 2
  • My Java code does found the same result. I've been lazy. – comicurus Aug 26 '16 at 11:16
  • 5
    Or: `from itertools import count;print(next(x for x in count(0, 450) if set(str(x)) == {'0','1'}))`. – Bakuriu Aug 27 '16 at 19:05
  • If python has a function for “_string consists of "01"_” or “_find one of "23456789"_” that would probably be more efficient — but not as fast as PM 2Ring’s. – PJTraill Aug 31 '16 at 18:25

Here's another brute-force Python script, but it's rather more efficient than shiftypixlz's.

target = 450
i = 1
while True:
    n = int(format(i, 'b'))
    if n % target == 0:
    i += 1

print(n, n // target)


11111111100 24691358

n = int(format(i, 'b')) first converts the integer i to a string of binary digits, but then interprets that string as a decimal integer.

PM 2Ring
  • 4,461
  • 15
  • 26

one more way. let x be the required number.

for a number to be multiple of 450, it should be multiple of 10. so 10.y =x now y should be multiple of 45. it should be first multiple of 5. so a number with only 1, o will be multiple of 5 if last digit is 0. so y = 2. w/9...dividing 10 by 5 gives 2 in numerator.

2.w should be mulitple of 9 and should contain only 1,0.

using the fact that sum of digits should be multiple of 9 for a number to be multiple of 9,

2.w should be 111111111.

adding two zeros extra. 11111111100.

thus 11111111100 is the required number.

lengthy process but easy to understand.

  • 2,321
  • 12
  • 23