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.

Showing 1-8 of 8 results.

A004431 Numbers that are the sum of 2 distinct nonzero squares.

Original entry on oeis.org

5, 10, 13, 17, 20, 25, 26, 29, 34, 37, 40, 41, 45, 50, 52, 53, 58, 61, 65, 68, 73, 74, 80, 82, 85, 89, 90, 97, 100, 101, 104, 106, 109, 113, 116, 117, 122, 125, 130, 136, 137, 145, 146, 148, 149, 153, 157, 160, 164, 169, 170, 173, 178, 180, 181, 185, 193, 194, 197
Offset: 1

Views

Author

Keywords

Comments

Numbers whose prime factorization includes at least one prime congruent to 1 mod 4 and any prime factor congruent to 3 mod 4 has even multiplicity. - Franklin T. Adams-Watters, May 03 2006
Reordering of A055096 by increasing values and without repetition. - Paul Curtz, Sep 08 2008
A063725(a(n)) > 1. - Reinhard Zumkeller, Aug 16 2011
The square of these numbers is also the sum of two nonzero squares, so this sequence is a subsequence of A009003. - Jean-Christophe Hervé, Nov 10 2013
Closed under multiplication. Primitive elements are those with exactly one prime factor congruent to 1 mod 4 with multiplicity one (A230779). - Jean-Christophe Hervé, Nov 10 2013
From Bob Selcoe, Mar 23 2016: (Start)
Numbers c such that there is d < c, d >= 1 where c + d and c - d are square. For example, 53 + 28 = 81, 53 - 28 = 25.
Given a prime p == 1 mod 4, a term appears if and only if it is of the form p^i, p*2^j or p*k^2 {i,j,k >= 1}, or a product of any combination of these forms. Therefore, the products of any terms to any powers also are terms. For example, p(1) = 5 and p(2) = 13 so term 45 appears because 5*3^2 = 45 and term 416 appears because 13*2^5 = 416; therefore 45 * 416 = 18720 appears, as does 45^3 * 416^11 = 18720^3 * 416^8.
Numbers of the form j^2 + 2*j*k + 2*k^2 {j,k >= 1}. (End)
Suppose we have a term t = x^2 + y^2. Then s^2*t = (s*x)^2 + (s*y)^2 is a term for any s > 0. Also 2*t = (y+x)^2 + (x-y)^2 is a term. It follows that q*s^2*t is a term for any s > 0 and q=1 or 2. Examples: 2*7^2*26 = 28^2 + 42^2; 6^2*17 = 6^2 + 24^2. - Jerzy R Borysowicz, Aug 11 2017
To find terms up to some upper bound u, we can search for x^2 + y^2 = t where x is odd and y is even. Then we add all numbers of the form 2^m * t <= u and then remove duplicates. - David A. Corneth, Oct 04 2017
From Bernard Schott, Apr 13 2022: (Start)
The 5th comment "Closed under multiplication" can be proved with Brahmagupta's identity: (a^2+b^2) * (c^2+d^2) = (ac + bd)^2 + (ad - bc)^2.
The subsequence of primes is A002144. (End)

Examples

			53 = 7^2 + 2^2, so 53 is in the sequence.
		

Crossrefs

Programs

  • Haskell
    import Data.List (findIndices)
    a004431 n = a004431_list !! (n-1)
    a004431_list = findIndices (> 1) a063725_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Maple
    isA004431 := proc(n)
        local a,b ;
        for a from 2 do
            if a^2>= n then
                return false;
            end if;
            b := n -a^2 ;
            if b < 1 then
                return false ;
            end if;
            if issqr(b) then
                if ( sqrt(b) <> a ) then
                    return true;
                end if;
            end if;
        end do:
        return false;
    end proc:
    A004431 := proc(n)
        option remember ;
        local a;
        if n = 1 then
            5;
        else
            for a from procname(n-1)+1 do
                if isA004431(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc: # R. J. Mathar, Jan 29 2013
  • Mathematica
    A004431 = {}; Do[a = 2 m * n; b = m^2 - n^2; c = m^2 + n^2; AppendTo[A004431, c], {m, 100}, {n, m - 1}]; Take[Union@A004431, 63] (* Robert G. Wilson v, May 02 2009 *)
    Select[Range@ 200, Length[PowersRepresentations[#, 2, 2] /. {{0, } -> Nothing, {a, b_} /; a == b -> Nothing}] > 0 &] (* Michael De Vlieger, Mar 24 2016 *)
  • PARI
    select( isA004431(n)={n>1 && vecmin((n=factor(n)%4)[,1])==1 && ![f[1]>2 && f[2]%2 | f<-n~]}, [1..199]) \\ M. F. Hasler, Feb 06 2009, updated Nov 24 2019
    
  • PARI
    is(n)=if(n<5, return(0)); my(f=factor(n)%4); if(vecmin(f[, 1])>1, return(0)); for(i=1, #f[, 1], if(f[i, 1]==3 && f[i, 2]%2, return(0))); 1
    for(n=1, 1e3, if(is(n), print1(n, ", "))) \\ Altug Alkan, Dec 06 2015
    
  • PARI
    upto(n) = {my(res = List(), s); forstep(i=1, sqrtint(n), 2, forstep(j = 2, sqrtint(n - i^2), 2, listput(res, i^2 + j^2))); s = #res; for(i = 1, s, t = res[i]; for(e = 1, logint(n \ res[i], 2), listput(res, t<<=1))); listsort(res, 1); res} \\ David A. Corneth, Oct 04 2017
    
  • Python
    def aupto(limit):
      s = [i*i for i in range(1, int(limit**.5)+2) if i*i < limit]
      s2 = set(a+b for i, a in enumerate(s) for b in s[i+1:] if a+b <= limit)
      return sorted(s2)
    print(aupto(197)) # Michael S. Branicky, May 10 2021

A046109 Number of lattice points (x,y) on the circumference of a circle of radius n with center at (0,0).

Original entry on oeis.org

1, 4, 4, 4, 4, 12, 4, 4, 4, 4, 12, 4, 4, 12, 4, 12, 4, 12, 4, 4, 12, 4, 4, 4, 4, 20, 12, 4, 4, 12, 12, 4, 4, 4, 12, 12, 4, 12, 4, 12, 12, 12, 4, 4, 4, 12, 4, 4, 4, 4, 20, 12, 12, 12, 4, 12, 4, 4, 12, 4, 12, 12, 4, 4, 4, 36, 4, 4, 12, 4, 12, 4, 4, 12, 12, 20, 4, 4, 12, 4, 12, 4, 12, 4, 4, 36
Offset: 0

Views

Author

Keywords

Comments

Also number of Gaussian integers x + yi having absolute value n. - Alonso del Arte, Feb 11 2012
The indices of terms not equaling 4 or 12 correspond to A009177, n>0. - Bill McEachen, Aug 14 2025

Examples

			a(5) = 12 because the circumference of the circle with radius 5 will pass through the twelve points (5, 0), (4, 3), (3, 4), (0, 5), (-3, 4), (-4, 3), (-5, 0), (-4, -3), (-3, -4), (0, -5), (3, -4) and (4, -3). Alternatively, we can say the twelve Gaussian integers 5, 4 + 3i, ... , 4 - 3i all have absolute value of 5.
		

Crossrefs

Programs

  • Haskell
    a046109 n = length [(x,y) | x <- [-n..n], y <- [-n..n], x^2 + y^2 == n^2]
    -- Reinhard Zumkeller, Jan 23 2012
    
  • Maple
    N:= 1000: # to get a(0) to a(N)
    A:= Array(0..N):
    A[0]:= 1:
    for x from 1 to N do
      A[x]:= A[x]+4;
      for y from 1 to min(x-1,floor(sqrt(N^2-x^2))) do
         z:= x^2+y^2;
         if issqr(z) then
           t:= sqrt(z);
           A[t]:= A[t]+8;
         fi
      od
    od:
    seq(A[i],i=0..N); # Robert Israel, May 08 2015
  • Mathematica
    Table[Length[Select[Flatten[Table[r + I i, {r, -n, n}, {i, -n, n}]], Abs[#] == n &]], {n, 0, 49}] (* Alonso del Arte, Feb 11 2012 *)
  • PARI
    a(n)=if(n==0, return(1)); my(f=factor(n)); 4*prod(i=1,#f~, if(f[i,1]%4==1, 2*f[i,2]+1, 1)) \\ Charles R Greathouse IV, Feb 01 2017
    
  • PARI
    a(n)=if(n==0, return(1)); t=0; for(x=1, n-1, y=n^2-x^2; if(issquare(y), t++)); return(4*t+4) \\ Arkadiusz Wesolowski, Nov 14 2017
  • Python
    from sympy import factorint
    def a(n):
        r = 1
        for p, e in factorint(n).items():
            if p%4 == 1: r *= 2*e + 1
        return 4*r if n > 0 else 0
    # Orson R. L. Peters, Jan 31 2017
    

Formula

a(n) = A000328(n) - A051132(n).
a(n) = 8*A046080(n) + 4 for n > 0.
a(n) = A004018(n^2).
From Jean-Christophe Hervé, Dec 01 2013: (Start)
a(A084647(k)) = 28.
a(A084648(k)) = 36.
a(A084649(k)) = 44. (End)
a(n) = 4 * Product_{i=1..k} (2*e_i + 1) for n > 0, given that p_i^e_i is the i-th factor of n with p_i = 1 mod 4. - Orson R. L. Peters, Jan 31 2017
a(n) = [x^(n^2)] theta_3(x)^2, where theta_3() is the Jacobi theta function. - Ilya Gutkovskiy, Apr 20 2018
From Hugo Pfoertner, Sep 21 2023: (Start)
a(n) = 8*A063014(n) - 4 for n > 0.
a(n) = 4*A256452(n) for n > 0. (End)

A007692 Numbers that are the sum of 2 nonzero squares in 2 or more ways.

Original entry on oeis.org

50, 65, 85, 125, 130, 145, 170, 185, 200, 205, 221, 250, 260, 265, 290, 305, 325, 338, 340, 365, 370, 377, 410, 425, 442, 445, 450, 481, 485, 493, 500, 505, 520, 530, 533, 545, 565, 578, 580, 585, 610, 625, 629, 650, 680, 685, 689, 697, 725, 730, 740, 745, 754, 765
Offset: 1

Views

Author

Keywords

Comments

A025426(a(n)) > 1. - Reinhard Zumkeller, Aug 16 2011
For the question that is in the link AskNRICH Archive: It is easy to show that (a^2 + b^2)*(c^2 + d^2) = (a*c + b*d)^2 + (a*d - b*c)^2 = (a*d + b*c)^2 + (a*c - b*d)^2. So terms of this sequence can be generated easily. 5 is the least number of the form a^2 + b^2 where a and b distinct positive integers and this is a list sequence. This is the why we observe that there are many terms which are divisible by 5. - Altug Alkan, May 16 2016
Square roots of square terms: {25, 50, 65, 75, 85, 100, 125, 130, 145, 150, 169, 170, 175, 185, 195, 200, 205, 221, 225, 250, 255, 260, 265, 275, 289, 290, 300, 305, ...}. They are also listed by A009177. - Michael De Vlieger, May 16 2016

Examples

			50 is a term since 1^2 + 7^2 and 5^2 + 5^2 equal 50.
25 is not a term since though 3^2 + 4^2 = 25, 25 is square, i.e., 0^2 + 5^2 = 25, leaving it with only one possible sum of 2 nonzero squares.
625 is a term since it is the sum of squares of {0,25}, {7,24}, and {15,20}.
		

References

  • Ming-Sun Li, Kathryn Robertson, Thomas J. Osler, Abdul Hassen, Christopher S. Simons and Marcus Wright, "On numbers equal to the sum of two squares in more than one way", Mathematics and Computer Education, 43 (2009), 102 - 108.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • D. Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, 125.

Crossrefs

Subsequence of A001481. A subsequence is A025285 (2 ways).

Programs

  • Haskell
    import Data.List (findIndices)
    a007692 n = a007692_list !! (n-1)
    a007692_list = findIndices (> 1) a025426_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Mathematica
    Select[Range@ 800, Length@ Select[PowersRepresentations[#, 2, 2], First@ # != 0 &] > 1 &] (* Michael De Vlieger, May 16 2016 *)
  • PARI
    isA007692(n)=nb = 0; lim = sqrtint(n); for (x=1, lim, if ((n-x^2 >= x^2) && issquare(n-x^2), nb++); ); nb >= 2; \\ Altug Alkan, May 16 2016
    
  • PARI
    is(n)=my(t); if(n<9, return(0)); for(k=sqrtint(n\2-1)+1,sqrtint(n-1), if(issquare(n-k^2)&&t++>1, return(1))); 0 \\ Charles R Greathouse IV, Jun 08 2016

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

Original entry on oeis.org

25, 50, 65, 85, 100, 125, 130, 145, 169, 170, 185, 200, 205, 221, 225, 250, 260, 265, 289, 290, 305, 325, 338, 340, 365, 370, 377, 400, 410, 425, 442, 445, 450, 481, 485, 493, 500, 505, 520, 530, 533, 545, 565, 578, 580, 585, 610, 625, 629, 650, 676, 680
Offset: 1

Views

Author

Keywords

Comments

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.
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).

Examples

			50 = 7^2 + 1^2 = 5^2 + 5^2, so 50 is in the sequence.
		

Crossrefs

Programs

  • Haskell
    import Data.List (findIndices)
    a118882 n = a118882_list !! (n-1)
    a118882_list = findIndices (> 1) a000161_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Mathematica
    Select[Range[1000], Length[PowersRepresentations[#, 2, 2]] > 1&] (* Jean-François Alcover, Mar 02 2019 *)
  • Python
    from itertools import count, islice
    from math import prod
    from sympy import factorint
    def A118882_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            f = factorint(n)
            if 1>1):
                yield n
    A118882_list = list(islice(A118882_gen(),30)) # Chai Wah Wu, Sep 09 2022

Formula

A000161(a(n)) > 1. [Reinhard Zumkeller, Aug 16 2011]

A164282 Hypotenuses of more than two Pythagorean triangles.

Original entry on oeis.org

65, 85, 125, 130, 145, 170, 185, 195, 205, 221, 250, 255, 260, 265, 290, 305, 325, 340, 365, 370, 375, 377, 390, 410, 425, 435, 442, 445, 455, 481, 485, 493, 500, 505, 510, 520, 530, 533, 545, 555, 565, 580, 585, 595, 610, 615, 625, 629, 650, 663, 680, 685, 689
Offset: 1

Views

Author

Keywords

Comments

Also, hypotenuses c of Pythagorean triangles with legs a and b such that a and b are also the hypotenuses of Pythagorean triangles, where the Pythagorean triples (x1,y1,a) and (x2,y2,b) are similar triangles, but the Pythagorean triples (a,b,c) and (x1,y1,a) are not similar. For example, 65^2 = 25^2 + 60^2 with 25^2 = 15^2 + 20^2 and 60^2 = 36^2 + 48^2 with the two smaller triangles being similar. - Naohiro Nomoto

Examples

			65 is included because there are 4 distinct Pythagorean triangles with hypotenuse 65. In particular, 65^2 = 16^2 + 63^2 = 25^2 + 60^2 = 33^2 + 56^2 = 39^2 + 52^2.
		

Crossrefs

Programs

  • Mathematica
    Clear[lst,f,n,i,k] f[n_]:=Module[{i=0,k=0},Do[If[Sqrt[n^2-i^2]==IntegerPart[Sqrt[n^2-i^2]],k++ ],{i,n-1,1,-1}];k/2]; lst={};Do[If[f[n]>2,AppendTo[lst,n]],{n,5*5!}];lst
  • PARI
    ok(n)={my(t=0); for(k=1, sqrtint(n^2\2), t += issquare(n^2-k^2)); t>2}
    select(ok, [1..1000]) \\ Andrew Howroyd, Aug 17 2018

Extensions

Terms a(45) and beyond from Andrew Howroyd, Aug 17 2018

A295554 a(n) is the number of distinct integer-sided triangles inscribed in a circle of radius A009003(n) whose inradius are integers.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 12, 1, 1, 1, 1, 5, 1, 1, 1, 12, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 10, 12, 1, 1, 1, 1, 1, 12, 1, 1, 1, 5, 1, 1, 1, 1, 1, 1, 1, 1, 5, 12, 1, 1, 5, 1, 1
Offset: 1

Views

Author

Michel Lagneau, Feb 03 2018

Keywords

Comments

For n <= 200, the number of distinct integer-sided triangles inscribed in a circle of radius A009003(n) whose inradius are integers belongs to the set E = {1, 5, 10, 12, 38} where a(168) = 38 (see the table given in reference). Is the set E infinite when n is infinite?
a(m) > 1 for m = 7, 18, 26, 31, 35, ... and {A009003(m)} = {25, 50, 65, 75, 85, ...} = {A009177}.
We observe geometric properties:
If a(n) = 1, the unique triangle is a right triangle.
If a(n) = 5, we find two right triangles, two isosceles triangles and another triangle (neither isosceles nor right triangle).
If a(n) = 10, we find three right triangles, two isosceles triangles and five other triangles.
If a(n) = 12, we find four right triangles and eight other triangles.
The area A of a triangle whose sides have lengths u, v, and w is given by Heron's formula: A = sqrt(s*(s-u)*(s-v)*(s-w)), where s = (u+v+w)/2.
The inradius r is given by r = A/s and the circumradius is given by R = u*v*w/4A.

Examples

			a(7) = 5 because there exists 5 distinct triangles of integer circumradius R = A009003(7)= 25 with the corresponding integer inradius {4, 6, 8, 10, 12}.
		

Crossrefs

Programs

  • Mathematica
    A009003=Select[Range[200], Length[PowersRepresentations[#^2, 2, 2]] > 1 &];lst= {};Do[R=Part[A009003,n];it=0;Do[s=(a+b+c)/2;If[IntegerQ[s],area2=s (s-a) (s-b) (s-c);If[area2>0&&IntegerQ[Sqrt[area2]]&&R==a*b*c/(4*Sqrt[area2])&&IntegerQ[Sqrt[area2]/s],it=it+1]],{a,2*R},{b,a},{c,b}];AppendTo[lst,it],{n,1,30}];lst

A162597 Ordered hypotenuses of primitive Pythagorean triangles, A008846, which are not hypotenuses of non-primitive Pythagorean triangles with any shorter legs.

Original entry on oeis.org

5, 13, 17, 25, 29, 37, 41, 53, 61, 65, 73, 85, 89, 97, 101, 109, 113, 137, 145, 149, 157, 173, 181, 185, 193, 197, 221, 229, 233, 241, 257, 265, 269, 277, 281, 293, 313, 317, 325, 337, 349, 353, 365, 373, 377, 389, 397, 401, 409, 421, 433, 445, 449, 457, 461
Offset: 1

Views

Author

Keywords

Comments

Hypotenuses of primitive Pythagorean triangles are shown in A008846 and A020882, and may also be hypotenuses of non-primitive Pythagorean triangles (see A009177, A118882). The sequence contains those hypotenuses of A008846 where in the set of Pythagorean triangles with this hypotenuse the one with the shortest leg is a primitive one.
This ordering first on hypotenuses, then filtering on the shortest legs, and then selecting the primitive triangles removes 125, 169, 205, 289, 305, 425, etc. from A008846.

Examples

			The hypotenuse 25 appears in the triangle 25^2 = 7^2 + 24^2 (primitive) and in the triangle 25^2 = 15^2 + 20^2 (non-primitive). The triangle with the shortest leg (here: 7) is primitive, so 25 is in the sequence.
The hypotenuse 125 appears in the triangles 125^2 = 35^2 + 120^2 (non-primitive), 125^2 = 44^2 + 117^2 (primitive), 125^2 = 75^2 + 100^2 (non-primitive). The case with the shortest leg (here: 35) of these 3 is not primitive, so 125 is not in the sequence.
		

Crossrefs

Programs

  • Mathematica
    f[n_]:=Module[{k=1},While[(n-k^2)^(1/2)!=IntegerPart[(n-k^2)^(1/2)],k++; If[2*k^2>=n,k=0;Break[]]];k]; lst1={};Do[If[f[n^2]>0,a=f[n^2];b=(n^2-a^2)^(1/ 2);If[GCD[n,a,b]==1,AppendTo[lst1,n]]],{n,3,6!}];lst1

Extensions

Definition clarified by R. J. Mathar, Aug 14 2009

A270385 Numbers n such that n^2 is a term of A007692 while n is not.

Original entry on oeis.org

25, 75, 100, 150, 169, 175, 195, 225, 255, 275, 289, 300, 350, 375, 390, 400, 435, 455, 475, 507, 510, 525, 550, 555, 575, 595, 600, 615, 663, 675, 676, 700, 715, 750, 775, 780, 795, 825, 841, 867, 870, 875, 900, 910, 915, 935, 950, 975, 1014, 1015, 1020, 1050, 1075, 1095
Offset: 1

Views

Author

Altug Alkan, May 17 2016

Keywords

Comments

Subsequence of A009177.

Examples

			25 is a term because 25 is not a term of A007692 while 25^2 = 625 is a term of A007692.
		

Crossrefs

Programs

  • Mathematica
    fQ[n_] := Length@ Select[PowersRepresentations[n, 2, 2], First@ # != 0 &] > 1; Select[Range@1100, And[! fQ@ #, fQ[#^2]] &] (* Michael De Vlieger, May 17 2016 *)
  • PARI
    isA007692(n) = {nb = 0; lim = sqrtint(n); for (x=1, lim, if ((n-x^2 >= x^2) && issquare(n-x^2), nb++); ); nb >= 2; }
    lista(nn) = for(n=1, nn, if(!isA007692(n) && isA007692(n^2), print1(n, ", ")));
Showing 1-8 of 8 results.