5
$\begingroup$

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?

$\endgroup$
3
  • 1
    $\begingroup$ Am a bit confused about this question. I assume "digital sum" means "the sum of its digits"? So it's asking for numbers that, the sum of its digits in base ten has the same expression as the sum of its bits in base two? Could you give an example of any such number? $\endgroup$ Nov 11, 2020 at 16:26
  • $\begingroup$ Do the sums have to have the same representation in the corresponding base, or the same value (independent of the base)? E.g. 10 (base 10) and 10 (base 2) or 2 (base 10) and 10 (base 2). $\endgroup$
    – Sleafar
    Nov 11, 2020 at 16:27
  • 1
    $\begingroup$ This is oeis.org/A037308. $\endgroup$ Nov 11, 2020 at 17:03

2 Answers 2

5
$\begingroup$

@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.

$\endgroup$
3
$\begingroup$

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]

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.