|
|
A350692
|
|
Smallest number with exactly n zeros in its digits both in decimal and binary representation.
|
|
2
|
|
|
0, 1003, 130007, 1003007, 50200030, 100007900, 1000300030, 102000001007, 1080007000030, 30090004000500, 100004000300030, 1020070000000500, 9000050000003000, 1000000800080003007, 4003700000000300000, 100000070002000003007, 1000006000000010027000
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
LINKS
|
|
|
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:
yield b
r = 10**(n-1)
for a in range(1, 10):
k = a*r
yield k+b
if n == 1:
return 0
for l in count(n):
r = 10**(l-1)
for a in range(1, 10):
k = a*r
m = k+s
if bin(m)[2:].count('0') == n:
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn,base
|
|
AUTHOR
|
|
|
EXTENSIONS
|
|
|
STATUS
|
approved
|
|
|
|