login
A335051
a(n) is the smallest decimal number > 1 such that when it is written in all bases from base 2 to base n those numbers all contain both 0 and 1.
2
2, 9, 19, 28, 145, 384, 1128, 2601, 2601, 101256, 103824, 382010, 572101, 971400, 1773017, 1773017, 22873201, 64041048, 64041048, 1193875201, 2496140640, 10729882801, 21660922801, 120068616277, 333679563001, 427313653201, 427313653201, 10436523921264, 10868368953601
OFFSET
2,1
COMMENTS
The sequence is infinite since 1 + lcm(2,...,n)^2 is always a candidate for a(n). - Giovanni Resta, May 24 2020
LINKS
EXAMPLE
a(3) = 9 as 9_2 = 1001 and 9_3 = 100, both of which contain a 0 and 1.
a(6) = 145 as 145_2 = 10010001, 145_3 = 12101, 145_4 = 2101, 145_5 = 1040, 145_6 = 401, all of which contain a 0 and 1.
a(9) = 2601 as 2601_2 = 101000101001, 2601_3 = 10120100, 2601_4 = 220221, 2601_5 = 40401, 2602_6 = 20013, 2601_7 = 10404, 2601_8 = 5051, 2601_9 = 3510, all of which contain a 0 and 1. Note that, as 2601 also contains a 0 and 1, a(10) = 2601.
a(16) = 1773017 as 1773017_2 = 110110000110111011001, 1773017_3 = 10100002010022, 1773017_4 = 12300313121, 1773017_5 = 423214032, 1773017_6 = 102000225, 1773017_7 = 21033101, 1773017_8 = 6606731, 1773017_9 = 3302108, 1773017_10 = 1773017, 1773017_11 = 1001104, 1773017_12 = 716075, 1773017_13 = 4A102C, 1773017_14 = 342201, 1773017_15 = 250512, 1773017_16 = 1B0DD9, all of which contain a 0 and 1.
MATHEMATICA
a[n_] := Block[{k=2}, While[ AnyTrue[ Range[n, 2, -1], ! SubsetQ[ IntegerDigits[k, #], {0, 1}] &], k++]; k]; a /@ Range[2, 13] (* Giovanni Resta, May 24 2020 *)
PROG
(Python)
from numba import njit
@njit
def hasdigits01(n, b):
has0, has1 = False, False
while n >= b:
n, r = divmod(n, b)
if r == 0: has0 = True
if r == 1: has1 = True
if has0 and has1: return True
return has0 and (has1 or n==1)
@njit
def a(n, start=2):
k = start
while True:
for b in range(n, 1, -1):
if not hasdigits01(k, b): break
else: return k
k += 1
anm1 = 2
for n in range(2, 21):
an = a(n, start=anm1)
print(an, end=", ")
anm1 = an # Michael S. Branicky, Feb 09 2021
KEYWORD
nonn,base
AUTHOR
EXTENSIONS
a(29)-a(30) from Giovanni Resta, May 24 2020
STATUS
approved