OFFSET
1,1
COMMENTS
From Fermat's two squares theorem, every prime of the form 4k + 1 is a term (A002144). - Bernard Schott, Apr 15 2022
LINKS
Donovan Johnson, Table of n, a(n) for n = 1..1000.
Art of Problem Solving, Fermat's Two Squares Theorem.
FORMULA
A025441(a(n)) = 1. - Reinhard Zumkeller, Dec 20 2013
MATHEMATICA
nn = 229; t = Table[0, {nn}]; lim = Floor[Sqrt[nn - 1]]; Do[num = i^2 + j^2; If[num <= nn, t[[num]]++], {i, lim}, {j, i - 1}]; Flatten[Position[t, 1]] (* T. D. Noe, Apr 07 2011 *)
a[1] = 5; a[ n_] := a[n] = Module[ {s = a[n - 1], t = True, j}, While[ t, s++; Do[ If[ i^2 + (j = Floor[Sqrt[s - i^2]])^2 == s && i < j, t = False; Break], {i, Sqrt[s/2]}]]; s]; (* Michael Somos, Jan 20 2019 *)
PROG
(Haskell)
a025302 n = a025302_list !! (n-1)
a025302_list = [x | x <- [1..], a025441 x == 1]
(Python)
from collections import Counter
from itertools import combinations
def aupto(lim):
s = filter(lambda x: x <= lim, (i*i for i in range(1, int(lim**.5)+2)))
s2 = filter(lambda x: x <= lim, (sum(c) for c in combinations(s, 2)))
s2counts = Counter(s2)
return sorted(k for k in s2counts if k <= lim and s2counts[k] == 1)
print(aupto(229)) # Michael S. Branicky, May 10 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
STATUS
approved