login
Primes p such that all digits of p^2 appear in p.
2

%I #12 Nov 01 2023 21:52:26

%S 1049,17923,49261,81619,94583,100469,100549,102953,107251,110923,

%T 125789,149827,184903,256169,279863,285101,289573,298327,370421,

%U 406951,459521,471923,472963,492671,493621,497521,499423,502261,504821,569423,582139,597823,631927

%N Primes p such that all digits of p^2 appear in p.

%H Robert Israel, <a href="/A030083/b030083.txt">Table of n, a(n) for n = 1..10000</a>

%p R:= NULL: count:= 0: p:= 2:

%p while count < 100 do

%p p:= nextprime(p);

%p if convert(convert(p^2,base,10),set) subset convert(convert(p,base,10),set) then

%p count:= count+1; R:= R,p

%p fi

%p od:

%p R; # _Robert Israel_, Nov 01 2023

%o (Python)

%o from sympy import isprime

%o def ok(n): return isprime(n) and set(str(n)) >= set(str(n**2))

%o print([k for k in range(10**6) if ok(k)]) # _Michael S. Branicky_, Nov 01 2023

%Y Contains A050288.

%Y Cf. A030084.

%K nonn,base

%O 1,1

%A _Patrick De Geest_

%E Offset corrected by _Robert Israel_, Nov 01 2023