Find four consecutive positive integers each with digital sum in base 10 equal to its digital sum in base 2.
Can five such numbers be found?
Puzzling Stack Exchange is a question and answer site for those who create, solve, and study puzzles. It only takes a minute to sign up.
Sign up to join this communityFind four consecutive positive integers each with digital sum in base 10 equal to its digital sum in base 2.
Can five such numbers be found?
@JKHA's answer shows an example of four such numbers. I had deduced that the first number had to have
a binary representation that ends in 0111111110, and in decimal end in an 8 preceded by a digit other than 9.
I was not able to deduce the rest of the number, and was going to do a computer search, but JKHA already did so.
A simple proof showing that 5 is impossible:
With 5 consecutive binary numbers, one of the first four will end in 01, and the one after it will end in 10 and have the same binary digit sum.
We want the numbers to have matching base 10 digit sums, so we need two consecutive base 10 numbers with the same digit sum. This is impossible because when incrementing a number, trailing nines become zeroes and the next digit is incremented. This adds $1-9k$, where $k$ is the number of trailing nines, and this can never be zero.
If I correctly understood your question what you want is:
Sum of digits in base 10:
3013118 $\rightarrow$ 17
3013119 $\rightarrow$ 18
3013120 $\rightarrow$ 10
3013121 $\rightarrow$ 11
Sum of digits in base 2:
3013118 $\rightarrow$ 1011011111100111111110 $\rightarrow$ 17
3013119 $\rightarrow$ 1011011111100111111111 $\rightarrow$ 18
3013120 $\rightarrow$ 1011011111101000000000 $\rightarrow$ 10
3013121 $\rightarrow$ 1011011111101000000001 $\rightarrow$ 11
I found these numbers by testing one by one with this Julia code:
function puzzling_cons(a,b,consecutive=4)
for i in a:b
if sum([sum(digits(i+k, base=10)) == sum(digits(i+k, base=2)) for k in 0:consecutive])==consecutive+1
@show [sum(digits(i+k, base=10)) for k in 0:4]
@show [sum(digits(i+k, base=2)) for k in 0:4]
return i
end
if i % 100000 == 0
@show i
end
end
return 0
end
puzzling_cons(0,500000,3)
Jaap Scherpuis' answer shows it's not possible for 5 numbers :)
For curiosity:
Here are the first 21 first groups to match the propriety and the only ones to have numbers smaller than 1 billion.
[ 3 013 118, 3 013 119, 3 013 120, 3 013 121]
[ 12 101 118, 12 101 119, 12 101 120, 12 101 121]
[100 503 038, ...]
[100 600 318, ...]
[110 231 038, ...]
[123 000 318, ...]
[131 013 118, ...]
[134 213 118, ...]
[211 013 118, ...]
[222 021 118, ...]
[301 002 238, ...]
[310 213 118, ...]
[331 000 318, ...]
[332 101 118, ...]
[411 031 038, ...]
[501 020 158, ...]
[501 112 318, ...]
[510 021 118, ...]
[511 301 118, ...]
[520 005 118, ...]
[700 101 118, 700 101 119, 700 101 120, 700 101 121]