cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A345336 Prime numbers p such that the sum and the product of digits of p^2 are both squares.

This page as a plain text file.
%I A345336 #31 Feb 05 2025 18:31:56
%S A345336 2,3,101,103,257,283,347,401,463,491,499,509,571,599,653,661,743,751,
%T A345336 797,1013,1021,1031,1039,1103,1201,1229,1237,1301,1381,1399,1427,1453,
%U A345336 1499,1553,1571,1597,1667,1733,1741,1759,1823,2003,2011
%N A345336 Prime numbers p such that the sum and the product of digits of p^2 are both squares.
%C A345336 Primes in A061868.
%H A345336 Karl-Heinz Hofmann, <a href="/A345336/b345336.txt">Table of n, a(n) for n = 1..10000</a>
%e A345336 101^2 = 10201. The sum of the digits is 4, the product is 0: both are squares. Thus, 101 is in the sequence.
%p A345336 filter:= proc(n) local L;
%p A345336   if not isprime(n) then return false fi;
%p A345336   L:= convert(n^2,base,10);
%p A345336   issqr(convert(L,`+`)) and issqr(convert(L,`*`))
%p A345336 end proc:
%p A345336 select(filter, [$1..10000]); # _Robert Israel_, Jun 17 2021
%t A345336 Select[Range[3000], PrimeQ[#] && IntegerQ[Sqrt[Total[IntegerDigits[#^2]]]] && IntegerQ[Sqrt[Times @@ IntegerDigits[#^2]]] &]
%t A345336 Select[Prime[Range[3500]],With[{c=IntegerDigits[#^2]},AllTrue[{Sqrt[Total[c]],Sqrt[Times@@c]},IntegerQ]]&] (* _Harvey P. Dale_, Feb 05 2025 *)
%o A345336 (PARI) isok(p) =if (isprime(p), my(d=digits(p^2)); issquare(vecsum(d)) && issquare(vecprod(d))); \\ _Michel Marcus_, Jun 14 2021
%o A345336 (Python) from numbthy import isprime
%o A345336 counter = 1
%o A345336 for p in range (2,1090821):
%o A345336     if isprime(p) and (counter <= 10000):
%o A345336         pp_product = 1
%o A345336         pp_sum = 0
%o A345336         for digit in range (0, len(str(p*p))):
%o A345336             pp_product *= int(str(p*p)[digit])
%o A345336             pp_sum += int(str(p*p)[digit])
%o A345336         if pow(int(pp_product**0.5),2) == pp_product:
%o A345336             if pow(int(pp_sum**0.5),2) == pp_sum:
%o A345336                 print(counter, p)
%o A345336                 counter += 1; # _Karl-Heinz Hofmann_, Jun 17 2021
%Y A345336 Cf. A061868.
%K A345336 nonn,base
%O A345336 1,1
%A A345336 _Tanya Khovanova_, Jun 14 2021