A308917 Primes p such that the digits of p^2 are squares.
2, 3, 7, 97, 107, 701, 997, 1049, 7001, 10007, 10243, 20347, 70001, 97001, 100549, 202757, 306749, 379499, 700001, 997001, 1002247, 1070021, 3317257, 3346507, 9536249, 9970001, 10095247, 20470501, 21095021, 22144979, 94925771, 100000007, 100099501, 104933743, 202520347
Offset: 1
Examples
997 is a term because 997 is prime and 997^2 = 994009 with 0, 4, 9 that are all squares.
Links
- Giovanni Resta, Table of n, a(n) for n = 1..512
- G. L. Honaker, Jr. and Chris Caldwell, Prime Curios!, 446653271.
Crossrefs
Programs
-
MATLAB
p=primes(10000000); m=1; for u=1:length(p) digit=dec2base(p(u).^2,10)-'0'; if (mod(sqrt(digit), 1) == 0) sol(m)=p(u); m=m+1; end end sol % Marius A. Burtea, Jun 30 2019
-
Mathematica
ok[n_] := AllTrue[IntegerDigits[n], MemberQ[{0, 1, 4, 9}, #] &]; mo = Select[Range[1, 10^6, 2], ok@Mod[#^2, 10^6] &]; Reap[Sow@2; Do[x = 10^6 t + m; If[PrimeQ[x] && ok[x^2], Sow[x]], {t, 0, 202}, {m, mo}]][[2, 1]] (* Giovanni Resta, Jul 02 2019 *) Select[Prime[Range[11211000]],AllTrue[Sqrt[IntegerDigits[#^2]],IntegerQ]&] (* Harvey P. Dale, Aug 17 2021 *)
-
PARI
isok(p) = isprime(p) && (d=digits(p^2)) && (#select(x->issquare(x), d) == #d); \\ Michel Marcus, Jun 30 2019
Extensions
More terms from Michel Marcus, Jun 30 2019
Comments