%I #58 Mar 05 2022 22:36:38
%S 2,3,7,97,107,701,997,1049,7001,10007,10243,20347,70001,97001,100549,
%T 202757,306749,379499,700001,997001,1002247,1070021,3317257,3346507,
%U 9536249,9970001,10095247,20470501,21095021,22144979,94925771,100000007,100099501,104933743,202520347
%N Primes p such that the digits of p^2 are squares.
%C The prime numbers of the form p = 7 * 10^k + 1 with k > = 2 are terms of the sequence. For example, for k = 2, 3, 4, 5, 8, 9, 45, 136, 142, 158, 243, 923, .... The squares have the form p^2 = 49 * 10^(2*k) + 14 * 10^k + 1 and the digits 0, 1, 4 and 9. - _Marius A. Burtea_, Jul 01 2019
%C Same remark with primes of the form p = 10^k + 7 and k > = 2 that are also terms of this sequence. For example, for k = 2, 4, 8, 9, ... The squares have the form p^2 = 100^k + 14 * 10^k + 49, so with only the digits 0, 1, 4 and 9. These primes are in A159031 \ {17}. - _Bernard Schott_, Jul 01 2019
%C From _Chai Wah Wu_, Jul 03 2019: (Start)
%C The prime numbers of the form p = (10^m-3)*10^k + 1 with k > m > 0 are terms of this sequence. Note that this includes primes of the form 7 * 10^k + 1 with k >=2 described in the first comment above. The squares are of the form p^2 = (10^m-3)^2*10^(2*k) + 2(10^m-3)*10^k + 1. Note that (10^m-3)^2 = 10^m(10^m-6)+9 which only contains the digits 0, 4 and 9. Similarly, 2*(10^m-3) = 2*10^m-6 which only contains the digits 1, 9 and 4 and has m+1 <= k decimal digits. Thus p^2 only contains the digits 0, 1, 4, 9. Some examples include (m,k) = (2,3), (2,8), (2,15), (3,4), (3,18), (4,71), (5,20), (6,7), ...
%C A similar argument shows that prime numbers of the form p = 10^k + (10^m-3) for k >= 2*m > 0 (which includes the primes of the form 10^k+7) are also terms of this sequence. In this case some examples include (m,k) = (2,9), (2,10), (3,12), (3,18), (4,10), (4,11), (5,14), ...
%C Some other sets of terms are:
%C 1. primes of the form p = 20247*10^k+1 for k >= 5. Examples include k = 7, 25, 29, 31, ...
%C 2. primes of the form p = 10^k + 20247 for k >= 9. Examples include k = 11, 15, 18, 19, 20, ...
%C 3. primes of the form p = 2224745247*10^k+1 for k >= 10. Examples include k = 31, 57, 115, 163, ...
%C 4. primes of the form p = 10^k + 2224745247 for k >= 19. Examples include k = 87, 257, 645, 819, ...
%C (End)
%H Giovanni Resta, <a href="/A308917/b308917.txt">Table of n, a(n) for n = 1..512</a>
%H G. L. Honaker, Jr. and Chris Caldwell, <a href="https://primes.utm.edu/curios/page.php?short=446653271"> Prime Curios!, 446653271.</a>
%e 997 is a term because 997 is prime and 997^2 = 994009 with 0, 4, 9 that are all squares.
%t 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 *)
%t Select[Prime[Range[11211000]],AllTrue[Sqrt[IntegerDigits[#^2]],IntegerQ]&] (* _Harvey P. Dale_, Aug 17 2021 *)
%o (MATLAB) p=primes(10000000); m=1;
%o for u=1:length(p) digit=dec2base(p(u).^2,10)-'0';
%o if (mod(sqrt(digit), 1) == 0) sol(m)=p(u); m=m+1; end
%o end
%o sol % _Marius A. Burtea_, Jun 30 2019
%o (PARI) isok(p) = isprime(p) && (d=digits(p^2)) && (#select(x->issquare(x), d) == #d); \\ _Michel Marcus_, Jun 30 2019
%Y Cf. A000290, A019544, A046030.
%Y Cf. subsequences: A159031, A316969.
%Y Intersection of A000040 and A285550.
%K nonn,base
%O 1,1
%A _Bernard Schott_, Jun 30 2019
%E More terms from _Michel Marcus_, Jun 30 2019
|