OFFSET
1,2
LINKS
Scott R. Shannon, Table of n, a(n) for n = 1..40 (terms 1..23 from Michael S. Branicky)
EXAMPLE
a(2) = 1003 which in binary is 1111101011. Both representations contain exactly 2 zeros. And there is no smaller number satisfying this constraint.
MATHEMATICA
Join[{0}, Table[
t=0; While[!IntegerQ[k=Min@Flatten[Select[FromDigits/@ Select[Permutations[#], First@#!=0&], Count[IntegerDigits[#, 2], 0]==n&]&/@(Join[Table[0, n], #]&/@Tuples[Range@9, ++t])]]]; k, {n, 2, 7}]] (* Giorgos Kalogeropoulos, Jan 13 2022 *)
PROG
(Python)
from itertools import count
def A350692_helper(n, m): # generator in order of numbers with n decimal digits and m 0's. Leading zeros are allowed.
if n >= m:
if n == 1:
if m == 1:
yield 0
else:
yield from range(1, 10)
elif n == m:
yield 0
else:
for b in A350692_helper(n-1, m-1):
yield b
r = 10**(n-1)
for a in range(1, 10):
k = a*r
for b in A350692_helper(n-1, m):
yield k+b
def A350692(n):
if n == 1:
return 0
for l in count(n):
r = 10**(l-1)
for a in range(1, 10):
k = a*r
for s in A350692_helper(l-1, n):
m = k+s
if bin(m)[2:].count('0') == n:
return m # Chai Wah Wu, Jan 13 2022
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Ruediger Jehn, Jan 12 2022
EXTENSIONS
a(8)-a(17) from Michael S. Branicky, Jan 12 2022
STATUS
approved