login
A387143
a(n) is the smallest prime p not already in the sequence such that the digit string of p is contained as a substring in the digit string of p^n.
2
2, 5, 251, 83, 3, 7, 73, 29, 43, 13, 11, 19, 59, 61, 23, 31, 17, 67, 37, 71, 41, 47, 53, 167, 97, 79, 131, 89, 113, 127, 101, 347, 137, 109, 193, 227, 307, 163, 173, 139, 107, 157, 233, 149, 199, 263, 191, 151, 239, 103, 179, 257, 229, 293, 379, 223, 353, 313, 269
OFFSET
1,1
EXAMPLE
a(4) = 83 because the digit string "83" is contained as a substring in the digit string of 83^4 = 47458321 and for smaller primes (except for 5 which is already in the sequence) this is not the case.
MAPLE
A387143:=proc(N) # for a(1)..a(N)
local i, j, k, p, q, v;
v:=Vector(N);
j:=0;
for i while j<N do
p:=ithprime(i);
q:=convert(p, 'base', 10);
for k to N do
if v[k]=0 and verify(q, convert(p^k, 'base', 10), 'sublist') then
v[k]:=p;
j:=j+1;
break
fi
od
od;
return op(convert(v, list))
end proc;
A387143(59);
MATHEMATICA
s={}; Do[p=2; While[SequenceCount[IntegerDigits[p^n], IntegerDigits[p]]==0||MemberQ[s, p], p=NextPrime[p]]; AppendTo[s, p], {n, 59}]; s (* James C. McMahon, Sep 29 2025 *)
PROG
(PARI) lista(nn) = my(va = vector(nn), vsa = []); for (n=1, nn, my(p=2); while(vecsearch(vsa, p) || #strsplit(Str(p^n), Str(p)) < 2, p = nextprime(p+1)); va[n] = p; vsa = vecsort(Vec(va, n)); ); va; \\ Michel Marcus, Sep 23 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Felix Huber, Sep 22 2025
STATUS
approved