A385885 Nonprimes k such that k^2 - sopfr(k)^2 is a square, where sopfr = A001414.
1, 4, 366, 1095, 51846, 258410, 982815, 10653351
Offset: 1
Examples
a(4) = 1095 is a term because 1095 = 3 * 5 * 73 and 1095^2 - (3+5+73)^2 = 1192464 = 1092^2.
Programs
-
Maple
sopfr:= proc(n) local t; add(t[1]*t[2], t=ifactors(n)[2]) end proc: filter:= t -> not isprime(t) and issqr(t^2 - sopfr(t)^2): select(filter, [$1..10^8]);
-
Mathematica
q[k_] := !PrimeQ[k] && IntegerQ[Sqrt[k^2 - (Plus @@ Times @@@ FactorInteger[k])^2]]; Select[Range[10^6], q] (* Amiram Eldar, Aug 14 2025 *)
-
PARI
isok(k) = if (!ispseudoprime(k), my(f=factor(k)); issquare(k^2 - (f[, 1]~*f[, 2])^2)); \\ Michel Marcus, Aug 21 2025
-
Python
from math import isqrt from sympy import factorint, isprime def is_square(n): return n >= 0 and isqrt(n)**2 == n def ok(n): return not isprime(n) and is_square(n**2-sum(p*e for p,e in factorint(n).items())**2) print([k for k in range(10**6) if ok(k)]) # Michael S. Branicky, Aug 14 2025
Extensions
Edited to insert 1 by Robert Israel, Aug 22 2025