A380759 Number of coincident digits occurring in expression of integers in both base 2 and base 10.
1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 3
Offset: 1
Examples
a(10) = 2, because 10 in base 10 is 1010 in base 2 (coincident digits 1 and 0). For n=1002, the following a(1002) = 3 digits coincide, n = decimal 1002 n = binary 1111101010 ^^^ same digits
Programs
-
Mathematica
a[n_] := Total[Min /@ Transpose[(DigitCount[n, #, {0, 1}] & /@ {2, 10})]]; Array[a, 100] (* Amiram Eldar, Feb 04 2025 *)
-
PARI
a(n) = my(b=binary(n), d=digits(n)); min(#select(x->(x==1), b), #select(x->(x==1), d)) + min(#select(x->(x==0), b), #select(x->(x==0), d)); \\ Michel Marcus, Feb 04 2025
Extensions
More terms from Michel Marcus, Feb 28 2025
Comments