A030083 Primes p such that all digits of p^2 appear in p.
1049, 17923, 49261, 81619, 94583, 100469, 100549, 102953, 107251, 110923, 125789, 149827, 184903, 256169, 279863, 285101, 289573, 298327, 370421, 406951, 459521, 471923, 472963, 492671, 493621, 497521, 499423, 502261, 504821, 569423, 582139, 597823, 631927
Offset: 1
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
Programs
-
Maple
R:= NULL: count:= 0: p:= 2: while count < 100 do p:= nextprime(p); if convert(convert(p^2,base,10),set) subset convert(convert(p,base,10),set) then count:= count+1; R:= R,p fi od: R; # Robert Israel, Nov 01 2023
-
Mathematica
Select[Prime[Range[52000]],SubsetQ[IntegerDigits[#],IntegerDigits[#^2]]&] (* Harvey P. Dale, Aug 12 2025 *)
-
Python
from sympy import isprime def ok(n): return isprime(n) and set(str(n)) >= set(str(n**2)) print([k for k in range(10**6) if ok(k)]) # Michael S. Branicky, Nov 01 2023
Extensions
Offset corrected by Robert Israel, Nov 01 2023