OFFSET
1,1
COMMENTS
Primes in A061868.
LINKS
Karl-Heinz Hofmann, Table of n, a(n) for n = 1..10000
EXAMPLE
101^2 = 10201. The sum of the digits is 4, the product is 0: both are squares. Thus, 101 is in the sequence.
MAPLE
filter:= proc(n) local L;
if not isprime(n) then return false fi;
L:= convert(n^2, base, 10);
issqr(convert(L, `+`)) and issqr(convert(L, `*`))
end proc:
select(filter, [$1..10000]); # Robert Israel, Jun 17 2021
MATHEMATICA
Select[Range[3000], PrimeQ[#] && IntegerQ[Sqrt[Total[IntegerDigits[#^2]]]] && IntegerQ[Sqrt[Times @@ IntegerDigits[#^2]]] &]
PROG
(PARI) isok(p) =if (isprime(p), my(d=digits(p^2)); issquare(vecsum(d)) && issquare(vecprod(d))); \\ Michel Marcus, Jun 14 2021
(Python) from numbthy import isprime
counter = 1
for p in range (2, 1090821):
if isprime(p) and (counter <= 10000):
pp_product = 1
pp_sum = 0
for digit in range (0, len(str(p*p))):
pp_product *= int(str(p*p)[digit])
pp_sum += int(str(p*p)[digit])
if pow(int(pp_product**0.5), 2) == pp_product:
if pow(int(pp_sum**0.5), 2) == pp_sum:
print(counter, p)
counter += 1; # Karl-Heinz Hofmann, Jun 17 2021
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Tanya Khovanova, Jun 14 2021
STATUS
approved