cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A025302 Numbers that are the sum of 2 distinct nonzero squares in exactly 1 way.

This page as a plain text file.
%I A025302 #31 Apr 15 2022 10:00:28
%S A025302 5,10,13,17,20,25,26,29,34,37,40,41,45,50,52,53,58,61,68,73,74,80,82,
%T A025302 89,90,97,100,101,104,106,109,113,116,117,122,136,137,146,148,149,153,
%U A025302 157,160,164,169,173,178,180,181,193,194,197,200,202,208,212,218,225,226,229
%N A025302 Numbers that are the sum of 2 distinct nonzero squares in exactly 1 way.
%C A025302 From Fermat's two squares theorem, every prime of the form 4k + 1 is a term (A002144). - _Bernard Schott_, Apr 15 2022
%H A025302 Donovan Johnson, <a href="/A025302/b025302.txt">Table of n, a(n) for n = 1..1000</a>.
%H A025302 Art of Problem Solving, <a href="https://artofproblemsolving.com/wiki/index.php/Fermat&#39;s_Two_Squares_Theorem">Fermat's Two Squares Theorem</a>.
%H A025302 <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>.
%F A025302 A025441(a(n)) = 1. - _Reinhard Zumkeller_, Dec 20 2013
%t A025302 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 *)
%t A025302 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 *)
%o A025302 (Haskell)
%o A025302 a025302 n = a025302_list !! (n-1)
%o A025302 a025302_list = [x | x <- [1..], a025441 x == 1]
%o A025302 (Python)
%o A025302 from collections import Counter
%o A025302 from itertools import combinations
%o A025302 def aupto(lim):
%o A025302   s = filter(lambda x: x <= lim, (i*i for i in range(1, int(lim**.5)+2)))
%o A025302   s2 = filter(lambda x: x <= lim, (sum(c) for c in combinations(s, 2)))
%o A025302   s2counts = Counter(s2)
%o A025302   return sorted(k for k in s2counts if k <= lim and s2counts[k] == 1)
%o A025302 print(aupto(229)) # _Michael S. Branicky_, May 10 2021
%Y A025302 Cf. A002144 (subsequence), A009000, A009003, A024507, A025441, A004431.
%Y A025302 Cf. Subsequence of A001983; A004435.
%K A025302 nonn
%O A025302 1,1
%A A025302 _David W. Wilson_