login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A291926
a(n) is the smallest integer k>=0 such that 2^k contains every digit in base n, or 0 if no such integer exists.
3
1, 5, 0, 18, 25, 20, 0, 61, 68, 64, 72, 103, 110, 134, 0, 138, 141, 140, 141, 172, 191, 228, 225, 244, 306, 281, 272, 339, 384, 412, 0, 390, 421, 372, 472, 395, 441, 486, 495, 473, 566, 576, 629, 735, 626, 661, 706, 707, 741, 825, 782, 751, 811, 924, 930, 908, 927, 975, 1049, 934, 1018, 1070, 0
OFFSET
2,2
COMMENTS
a(n) >= ceiling(log_2(n)*(n-1)), whenever a(n)>0. This is because in order for an integer to have n digits in base n it must have at least a magnitude of n-1 in base n.
a(n) = 0 at all powers of 2 (except 2 itself). This is because powers of 2 in power-of-2 bases can only have 2 distinct digits. Is a(n) equal to 0 for any other values of n?
It seems that the base n representation of 2^(2*n^2) contains all n digits whenever n is not a power of 2. A proof of this would yield a negative answer to the above question. In the absence of a negative answer to this question, at least an algorithm would be desirable whose application to any concrete value of n solves the problem whether a(n)=0 for this n (for instance, if a(n)<n^2 for all n then a proof of this would yield such an algorithm). - Dimiter Skordev, Aug 18 2021
LINKS
Chai Wah Wu, Table of n, a(n) for n = 2..512 (n = 2..256 from Ely Golden).
EXAMPLE
a(3) = 5, since 2^5 is the smallest power of 2 which contains every digit in base 3: Namely, 2^5 is 1012 in base 3, whereas the previous powers are 1, 2, 11, 22, and 121, respectively, none of which contain all possible base-3 digits.
MATHEMATICA
TakeWhile[#, # > -1 &] &@ Table[If[And[IntegerQ@ #, # > 1] &@ Log2@ n, 0, SelectFirst[Range[2^11], Times @@ DigitCount[2^#, n] > 0 &]] /. k_ /; MissingQ@ k -> -1, {n, 2, 64}] (* Michael De Vlieger, Sep 05 2017 *)
PROG
(Python)
def floorLog(b, n):
x=-1
while(n>0):
x+=1
n//=b
return x
def distinctDigits(n, b):
li=[]
while(n>0):
li.append(n%b)
n//=b
li=list(set(li))
li.sort()
return li
def iroot(k, n):
u, s = n, n+1
while u < s:
s = u
t = (k-1) * s + n // (s**(k-1))
u = t // k
return s
def perfectPower(n):
if(n==1): return 0
x=1
for i in range(2, floorLog(2, n)+1):
if(iroot(i, n)**i==n): x=i
return x
def leastPandigital(b, n):
if(n<=1 or b<=1): return 0
if(n==2): return 2 if (b==(1<<b.bit_length())-1) else 1
if(iroot(perfectPower(n), n)==iroot(perfectPower(b), b)): return 0
a=(floorLog(b, n)*(n-1))
while(distinctDigits(b**a, n)!=list(range(n))): a+=1
return a
for i in range(2, 257):
print(str(i)+" "+str(leastPandigital(2, i)))
(Python)
from sympy.ntheory.digits import digits
def a(n):
b = bin(n)[2:]
if b.strip('0') == '1': return int(n == 2)
k = (len(b)-1)*(n-1)
while len(set(digits(2**k, n)[1:])) != n: k += 1
return k
print([a(n) for n in range(2, 65)]) # Michael S. Branicky, Oct 07 2021
(PARI) a(n) = {if (n==2, return (1)); if (ispower(n, , &k) && (k==2), return (0)); k = 1; while (#Set(digits(2^k, n)) != n, k++); k; } \\ Michel Marcus, Sep 06 2017
CROSSREFS
Cf. A090493.
Sequence in context: A368061 A094031 A022902 * A056461 A167355 A282577
KEYWORD
nonn,base
AUTHOR
Ely Golden, Sep 05 2017
STATUS
approved