The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
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

%I #50 Oct 08 2021 12:05:03

%S 1,5,0,18,25,20,0,61,68,64,72,103,110,134,0,138,141,140,141,172,191,

%T 228,225,244,306,281,272,339,384,412,0,390,421,372,472,395,441,486,

%U 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

%N 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.

%C 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.

%C 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?

%C 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

%H Chai Wah Wu, <a href="/A291926/b291926.txt">Table of n, a(n) for n = 2..512</a> (n = 2..256 from Ely Golden).

%e 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.

%t 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 *)

%o (Python)

%o def floorLog(b,n):

%o x=-1

%o while(n>0):

%o x+=1

%o n//=b

%o return x

%o def distinctDigits(n,b):

%o li=[]

%o while(n>0):

%o li.append(n%b)

%o n//=b

%o li=list(set(li))

%o li.sort()

%o return li

%o def iroot(k,n):

%o u, s = n, n+1

%o while u < s:

%o s = u

%o t = (k-1) * s + n // (s**(k-1))

%o u = t // k

%o return s

%o def perfectPower(n):

%o if(n==1): return 0

%o x=1

%o for i in range(2,floorLog(2,n)+1):

%o if(iroot(i,n)**i==n): x=i

%o return x

%o def leastPandigital(b,n):

%o if(n<=1 or b<=1): return 0

%o if(n==2): return 2 if (b==(1<<b.bit_length())-1) else 1

%o if(iroot(perfectPower(n),n)==iroot(perfectPower(b),b)): return 0

%o a=(floorLog(b,n)*(n-1))

%o while(distinctDigits(b**a,n)!=list(range(n))): a+=1

%o return a

%o for i in range(2,257):

%o print(str(i)+" "+str(leastPandigital(2,i)))

%o (Python)

%o from sympy.ntheory.digits import digits

%o def a(n):

%o b = bin(n)[2:]

%o if b.strip('0') == '1': return int(n == 2)

%o k = (len(b)-1)*(n-1)

%o while len(set(digits(2**k, n)[1:])) != n: k += 1

%o return k

%o print([a(n) for n in range(2, 65)]) # _Michael S. Branicky_, Oct 07 2021

%o (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

%Y Cf. A090493.

%K nonn,base

%O 2,2

%A _Ely Golden_, Sep 05 2017

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified June 1 12:42 EDT 2024. Contains 373023 sequences. (Running on oeis4.)