login
Smallest base b >= 2 for which b^n contains n as a substring.
3

%I #17 Dec 27 2023 11:54:23

%S 10,5,7,7,5,2,3,7,3,2,11,7,6,25,7,11,4,8,5,7,6,6,6,3,4,9,17,3,6,13,8,

%T 5,8,5,2,2,2,8,6,6,5,4,7,2,6,9,8,6,2,4,2,8,6,5,5,5,3,8,4,2,3,3,6,5,6,

%U 12,2,6,3,5,3,2,2,6,5,6,3,3,4,3,4,2,3,4,2,4,3,7,2,8,8,4,2,6,3,4,7,6,7,7

%N Smallest base b >= 2 for which b^n contains n as a substring.

%H Alois P. Heinz, <a href="/A061280/b061280.txt">Table of n, a(n) for n = 1..20000</a>

%e a(3) = 7 since 7^1 contains no 1, 7^2 contains no 2 and 7^3 contains a 3.

%p a:= proc(n) local b; for b from 2 while

%p searchtext(""||n, ""||(b^n))=0 do od; b

%p end:

%p seq(a(n), n=1..100); # _Alois P. Heinz_, Sep 28 2016

%t Table[b = 2; While[Length@ SequencePosition[IntegerDigits[b^n], IntegerDigits[n]] == 0, b++]; b, {n, 120}] (* _Michael De Vlieger_, Sep 28 2016, Version 10.1 *)

%o (Python)

%o def a(n):

%o b, s = 2, str(n)

%o while s not in str(b**n): b += 1

%o return b

%o print([a(n) for n in range(1, 101)]) # _Michael S. Branicky_, Oct 05 2021

%K base,easy,look,nonn

%O 1,1

%A _Erich Friedman_, Jun 06 2001