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.

A118882 Numbers which are the sum of two squares in two or more different ways.

This page as a plain text file.
%I A118882 #24 Sep 11 2022 00:40:01
%S A118882 25,50,65,85,100,125,130,145,169,170,185,200,205,221,225,250,260,265,
%T A118882 289,290,305,325,338,340,365,370,377,400,410,425,442,445,450,481,485,
%U A118882 493,500,505,520,530,533,545,565,578,580,585,610,625,629,650,676,680
%N A118882 Numbers which are the sum of two squares in two or more different ways.
%C A118882 Numbers whose prime factorization includes at least two primes (not necessarily distinct) congruent to 1 mod 4 and any prime factor congruent to 3 mod 4 has even multiplicity. Products of two values in A004431.
%C A118882 Squares of distances that are the distance between two points in the square lattice in two or more nontrivially different ways. A quadrilateral with sides a,b,c,d has perpendicular diagonals iff a^2+c^2 = b^2+d^2. This sequence is the sums of the squares of opposite sides of such quadrilaterals, excluding kites (a=b,c=d), but including right triangles (the degenerate case d=0).
%H A118882 Reinhard Zumkeller, <a href="/A118882/b118882.txt">Table of n, a(n) for n = 1..10000</a>
%H A118882 <a href="/index/Su#ssq">Index entries for sequences related to sums of squares</a>
%F A118882 A000161(a(n)) > 1. [_Reinhard Zumkeller_, Aug 16 2011]
%e A118882 50 = 7^2 + 1^2 = 5^2 + 5^2, so 50 is in the sequence.
%t A118882 Select[Range[1000], Length[PowersRepresentations[#, 2, 2]] > 1&] (* _Jean-François Alcover_, Mar 02 2019 *)
%o A118882 (Haskell)
%o A118882 import Data.List (findIndices)
%o A118882 a118882 n = a118882_list !! (n-1)
%o A118882 a118882_list = findIndices (> 1) a000161_list
%o A118882 -- _Reinhard Zumkeller_, Aug 16 2011
%o A118882 (Python)
%o A118882 from itertools import count, islice
%o A118882 from math import prod
%o A118882 from sympy import factorint
%o A118882 def A118882_gen(startvalue=1): # generator of terms >= startvalue
%o A118882     for n in count(max(startvalue,1)):
%o A118882         f = factorint(n)
%o A118882         if 1<int(not any(e&1 for e in f.values())) + (((m:=prod(1 if p==2 else (e+1 if p&3==1 else (e+1)&1) for p, e in f.items()))+((((~n & n-1).bit_length()&1)<<1)-1 if m&1 else 0))>>1):
%o A118882             yield n
%o A118882 A118882_list = list(islice(A118882_gen(),30)) # _Chai Wah Wu_, Sep 09 2022
%Y A118882 Cf. A004431, A009177, A085265.
%Y A118882 Cf. A007692, A001481, A022544.
%K A118882 nonn
%O A118882 1,1
%A A118882 _Franklin T. Adams-Watters_, May 03 2006