OFFSET
1,2
COMMENTS
LINKS
Robert Israel, Table of n, a(n) for n = 1..10000
EXAMPLE
31 is in the sequence because 31^2 + 1 = 2*13*37 and (37 - 31)^2 + 1 = 37.
43 is in the sequence because 43^2 + 1 = 2*5*5*37 and (37 - 43)^2 + 1 = 37.
MAPLE
with(numtheory):for n from 1 to 20000 do:x:=n^2+1:y:=factorset(x):n1:=nops(y):p:=y[n1]:q:=(p-n)^2+1:if q=p then printf(`%d, `, n): else fi:od:
# Alternative:
N:= 20000: # for terms <= N
R:= {1, 3}:
for m from 2 by 2 while m^2-m+1 <= N do
if isprime(m^2+1) then
R:= select(`<=`, {m^2+m+1, m^2-m+1}, N) union R;
fi
od:
sort(convert(R, list)); # Robert Israel, Feb 09 2026
MATHEMATICA
pn2pQ[n_]:=Module[{p=FactorInteger[n^2+1][[-1, 1]]}, (p-n)^2+1==p]; Select[ Range[20000], pn2pQ] (* Harvey P. Dale, Nov 20 2019 *)
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Lagneau, Feb 05 2012
STATUS
approved
