%I #34 May 26 2026 23:45:01
%S 2,4271,4591,7151,10973,13183,16111,19469,31151,32749,41887,43051,
%T 64033,65729,73471,74933,91541,122609,128591,142993,144451,181039,
%U 185071,187373,195593,263759,321199,328357,332477,363439,388961,413129,453311,489539,524087,528391,534311,536717
%N Primes p such that A001414(p-1)^2 + A001414(p+1)^2 is a perfect square, where A001414(n) is the sum of prime factors of n with multiplicity (sopfr).
%C Primes p for which (A001414(p-1), A001414(p+1)) form the legs of a right triangle with integer hypotenuse.
%C The reduced Pythagorean triples arising include (3,4,5), (9,40,41), (12,5,13), (33,56,65), and others. For example, a(6)=16111 and a(7)=19469 both yield the triple 16*(12,5,13).
%C Conjecture: this sequence is infinite (empirical observation; no proof is known).
%D D. E. Knuth, The Art of Computer Programming, Vol. 2, Addison-Wesley, 1998, Section 4.5.4 (on completely additive arithmetic functions).
%F a(n) is prime and there exists a positive integer h such that A001414(a(n)-1)^2 + A001414(a(n)+1)^2 = h^2.
%F Equivalently: a(n) is prime and A001414(a(n)-1)/A001414(a(n)+1) is a rational number whose square plus 1 is a perfect rational square (i.e., the ratio is a rational leg-to-leg ratio of a Pythagorean triple).
%e a(1) = 4271: 4270 = 2 * 5 * 7 * 61, so A001414(4270) = 75; 4272 = 2^4 * 3 * 89, so A001414(4272) = 100; 75^2 + 100^2 = 15625 = 125^2. Triple: 25*(3,4,5).
%e a(2) = 4591: 4590 = 2 * 3^3 * 5 * 17, so A001414(4590) = 33; 4592 = 2^4 * 7 * 41, so A001414(4592) = 56; 33^2 + 56^2 = 4225 = 65^2. Primitive triple (33,56,65).
%e a(3) = 7151: A001414(7150) = 36, A001414(7152) = 160; 36^2 + 160^2 = 26896 = 164^2. Triple: 4*(9,40,41).
%p sopfr:= proc(n) local t; add(t[1]*t[2], t = ifactors(n)[2]) end proc:
%p filter:= n -> isprime(n) and issqr(sopfr(n-1)^2 + sopfr(n+1)^2):
%p select(filter, [2,seq(i,i=3..10^6,2)]); # _Robert Israel_, May 21 2026
%t sopfr[n_] := Total[Times @@@ FactorInteger[n]]; Select[Prime[Range[5,50000]], IntegerQ[Sqrt[sopfr[#-1]^2 + sopfr[#+1]^2]]&]
%o (Python)
%o from sympy import factorint, nextprime
%o import math
%o def sopfr(n):
%o if n <= 1:
%o return 0
%o return sum(p * e for p, e in factorint(n).items())
%o def is_sq(n):
%o r = math.isqrt(n)
%o return r * r == n
%o p = 2
%o while p < 10**6:
%o if is_sq(sopfr(p-1)**2 + sopfr(p+1)**2):
%o print(p)
%o p = nextprime(p)
%o (PARI) sopfr(n) = my(f=factor(n)); sum(k=1, matsize(f)[1], f[k, 1]*f[k, 2]);
%o isok(p) = isprime(p) && issquare(sopfr(p-1)^2+sopfr(p+1)^2); \\ _Michel Marcus_, May 21 2026
%Y Cf. A001414 (sopfr), A086299 (Ruth-Aaron pairs: sopfr(n)=sopfr(n+1)), A074981 (Ruth-Aaron numbers), A001222 (Omega, number of prime factors with multiplicity).
%K nonn
%O 1,1
%A _Rudra Jadhav_, May 21 2026