%I #18 Feb 20 2023 07:52:16
%S 22,34,46,50,28,44,76,80,100,42,114,104,136,86,254,266,274,58,106,154,
%T 194,286,334,324,456,504,516,214,374,494,526,566,140,520,78,186,354,
%U 426,530,670,366,546,726,166,614,92,220,316,620,836,844,390,414,810
%N Numbers k such that k^2 + 1 = p*q, p and q primes gives the sums p+q not unique.
%C We obtain the subsets of numbers with the same sum of prime divisors: (22, 34, 46, 50), (28, 44, 76), (80, 100),... => sums 102, 162, 210, ...
%e 22^2 + 1 = 5*97 and 97 + 5 = 102;
%e 34^2 + 1 = 13*89 and 13 + 89 = 102;
%e 46^2 + 1 = 29*73 and 29 + 73 = 102;
%e 50^2 + 1 = 41*61 and 41 + 61 = 102.
%p # storage of sums and indices
%p with(numtheory): nn:=350: T:=array(1..nn): U:=array(1..1000): B:=array(1..nn): V:=array(1..1000): k:=1: for p from 1 to 1000 do: n:=p^2+1: x:= factorset(n): n1:=nops(x): n2 :=bigomega(n): if n1=2 and n2 = 2 then zz:=x[1]+x[2]: T[k]:=zz: U[k]:=zz: V[k]:=p: k:=k+1: else fi: od:
%p # ascending sort
%p for i from 1 to k do: mini:=i :for j from i+1 to nn do: if T[j]< T[mini] then mini:=j: else fi: od: if mini<> i then x:=T[i]: T[i]:=T[mini]: T[mini]:=x: else fi: od:
%p # detection of identical sums
%p z:=1:for a from 1 to 52 do: if T[a]=T[a+1] or T[a]=T[a+1] or T[a]=T[a+2] or T[a]=T[a+3] or T[a]=T[a+4] or T[a]=T[a+5] then B[z]:=T[a]: z:=z+1: else fi: od: for d from 1 to 52 do: for e from 1 to 1000 do: if B[d]= U[e] then printf(`%d, `, V[e]): else fi: od: od:
%o (Sage)
%o def A181177_yield_vecs(max_sum):
%o for s in [1..max_sum]:
%o pqs = ((p,s-p) for p in prime_range(s//2) if is_prime(s-p) and (p != s-p))
%o ss = list(sqrt(p*q-1) for p,q in pqs if is_square(p*q-1))
%o if len(ss) > 1: yield ss
%o a = flatten(list(A181177_yield_vecs(2000))) # _D. S. McNeil_, Jan 27 2011
%K nonn
%O 1,1
%A _Michel Lagneau_, Jan 25 2011
|