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-10 of 77 results. Next

A349536 Consider a circle on the Z X Z lattice with radius equal to the Pythagorean hypotenuse h(n) (A009003); a(n) = number of Pythagorean triples inside a Pi/4 sector of the circle.

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 22, 23, 24, 25, 26, 27, 31, 32, 33, 34, 35, 37, 38, 39, 40, 44, 45, 46, 47, 48, 49, 50, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 71, 75, 76, 77, 78, 79, 80, 84, 85, 86, 87, 89
Offset: 1

Views

Author

Alexander Kritov, Nov 21 2021

Keywords

Comments

Number of Pythagorean triples with hypotenuse less than or equal to the next one.

Examples

			The count of non-primitive Pythagorean triples as they appear in order of increasing hypotenuse:
.
       Hypotenuse
   n  (A009003(n))       Sides       a(n)
  --  ------------  ---------------  ----
   1        5            (3,4)         1
   2       10            (6,8)         2
   3       13            (5,12)        3
   4       15            (9,12)        4
   5       17            (8,15)        5
   6       20           (12,16)        6
   7       25       (7,24), (15,20)    8
   8       26           (10,24)        9
   9       29           (20,21)       10
		

References

  • W. Sierpinski, Pythagorean Triangles, Dover Publications, 2003.

Crossrefs

Cf. A349538 (extension to the full circle of Z^2 lattice).

Programs

  • C
    // see enclosed main.c
    for (long j=1;j< 101;++j)
    {
    for (long k=1;k< 101;++k)
    {
    if (k<=j)   // to avoid pairs (as we need 1/8 or quarter plane)
        {
              double hyp=sqrt(j*j+k*k);
              double c= (double) floor (hyp );
    if   (fabs(hyp - c) < DBL_EPSILON)  arr[r++]= (long) c;
    }}}
    bubbleSort(arr, r);//sort by hypotenuse increase
    for (long j=0;j< r;++j)
    {
       if  ( arr[j] != arr[j+1] )
        {
            // write to file: j is the sequence value a[n]*2
            // arr[j] is the hypotenuse value
        }
    }

Formula

Conjecture: the increment is a(n+1) - a(n) = 2^(m-1), where m is the sum of all powers of the Pythagorean primes (A002144) in the factorization of hypotenuse h(n+1) (see Eckert for PPT). However, starting from 58 the increment is 3.

A354379 Hypotenuses of Pythagorean triangles whose legs are also hypotenuse numbers (A009003).

Original entry on oeis.org

25, 50, 65, 75, 85, 89, 100, 109, 125, 130, 145, 149, 150, 169, 170, 173, 175, 178, 185, 195, 200, 205, 218, 221, 225, 229, 233, 250, 255, 260, 265, 267, 275, 289, 290, 293, 298, 300, 305, 313, 325, 327, 338, 340, 346, 349, 350, 353, 356, 365, 370, 375, 377, 390, 400
Offset: 1

Views

Author

Lamine Ngom, May 24 2022

Keywords

Comments

If m is in sequence, so is any multiple of m. Primitive elements (terms which are not divisible by any previous term) are A354381.

Examples

			25 is in sequence since each member of the Pythagorean triple (15, 20, 25) belongs to A009003.
The Pythagorean triple (39, 80, 89) has all its terms in A009003. Hence 89 is in sequence.
		

Crossrefs

Programs

  • Maple
    ishyp:= proc(n) local s; ormap(s -> s mod 4 = 1, numtheory:-factorset(n)) end proc:
    filter:= proc(n) local s;
      ormap(s -> ishyp(subs(s,x)) and ishyp(subs(s,y)), [isolve(x^2+y^2=n^2)])
    end proc:
    select(filter, [$1..1000]); # Robert Israel, Jan 10 2023
  • Mathematica
    ishyp[n_] := AnyTrue[FactorInteger[n][[All, 1]], Mod[#, 4] == 1&];
    filter[n_] := AnyTrue[Solve[x^2 + y^2 == n^2, Integers], ishyp[x /. #] && ishyp[y /. #]&];
    Select[Range[400], filter] (* Jean-François Alcover, May 11 2023, after Robert Israel *)

A162592 Hypotenuse numbers A009003 which cannot be represented as sum of 2 distinct nonzero squares.

Original entry on oeis.org

15, 30, 35, 39, 51, 55, 60, 70, 75, 78, 87, 91, 95, 102, 105, 110, 111, 115, 119, 120, 123, 135, 140, 143, 150, 155, 156, 159, 165, 174, 175, 182, 183, 187, 190, 195, 203, 204, 210, 215, 219, 220, 222, 230, 235, 238, 240, 246, 247, 255, 259, 267, 270, 273, 275
Offset: 1

Views

Author

Keywords

Comments

Numbers with both at least one prime factor of form 4k+1 (which makes the square decomposable into the sum of two squares), and with at least one prime factor of form 4k+3 to an odd multiplicity (which makes the number itself not decomposable). This is a direct consequence of Fermat's Christmas theorem on the sum of two squares (Fermat announced its proof - without giving it - in a letter to Mersenne dated December 25, 1640). - Jean-Christophe Hervé, Nov 19 2013
Numbers n such that n^2 is the sum of two nonzero squares while n is not. Also note that sequence is equivalent to "Hypotenuse numbers A009003 which cannot be represented as sum of 2 nonzero squares." The reason is, if n is the sum of two nonzero squares in exactly one way and n = a^2 + a^2, then n^2 cannot be the sum of two nonzero squares. - Altug Alkan, Apr 14 2016

Examples

			13 is hypotenuse number A009003(3) but can be represented as A004431(3), so 13 is not in this 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,AppendTo[lst1, n]],{n,3,5!}];lst1 (*A009003 Hypotenuse numbers (squares are sums of 2 distinct nonzero squares).*) lst2={};Do[If[f[n]>0,AppendTo[lst2, n]],{n,3,5!}];lst2 (*A004431 Numbers that are the sum of 2 distinct nonzero squares.*) Complement[lst1,lst2]

Formula

Extensions

Formulas added, entries checked by R. J. Mathar, Aug 14 2009

A212794 Triangular numbers (A000217) which are also hypotenuse numbers (A009003).

Original entry on oeis.org

10, 15, 45, 55, 78, 91, 105, 120, 136, 153, 190, 210, 300, 325, 351, 406, 435, 465, 561, 595, 630, 666, 703, 741, 780, 820, 861, 990, 1035, 1225, 1275, 1326, 1378, 1431, 1485, 1540, 1653, 1711, 1770, 1830, 1891, 2080, 2145, 2278, 2346, 2415, 2485, 2628
Offset: 1

Views

Author

M. F. Hasler, May 27 2012

Keywords

Crossrefs

Intersection of A000217 and A009003.

Programs

  • Maple
    ishyp:= proc(n) ormap(t -> t mod 4 = 1, numtheory:-factorset(n)) end proc:
    select(ishyp, [seq(i*(i+1)/2, i=1..100)]); # Robert Israel, Jun 02 2023
  • Mathematica
    A212794list[upto_]:=Select[PolygonalNumber[Range[4,upto]],AnyTrue[Map[Mod[First[#],4]==1&,FactorInteger[#]],TrueQ]&];A212794list[100] (* Paolo Xausa, Jul 28 2023 *)
  • PARI
    for(n=1,99, is_A009003(A000217(n)) & print1(A000217(n)","))
    
  • PARI
    is_A212794(n) = is_A000217(n) & is_A009003(n)

A278647 First differences of Hypotenuse numbers A009003.

Original entry on oeis.org

5, 3, 2, 2, 3, 5, 1, 3, 1, 4, 1, 2, 2, 1, 1, 4, 5, 1, 1, 1, 2, 3, 2, 1, 4, 3, 2, 3, 1, 1, 3, 2, 2, 3, 2, 2, 1, 1, 4, 2, 3, 1, 1, 2, 1, 1, 3, 1, 1, 2, 2, 1, 1, 2, 1, 2, 1, 2, 5, 5, 1, 1, 3, 3, 2, 1, 2, 1, 1, 3, 2, 1, 1, 2, 1, 4, 1, 4, 1, 3, 1, 1, 3, 2, 1, 1, 1, 2, 2, 3, 3, 1, 1, 2, 3, 2, 1, 1, 1, 3
Offset: 1

Views

Author

Zhandos Mambetaliyev, Nov 24 2016

Keywords

Comments

a(n) <= 5, since A009003 contains all multiples of 5. - Robert Israel, Dec 08 2016

Crossrefs

Cf. A009003.

Programs

  • Maple
    L:= select(t -> has(numtheory:-factorset(t) mod 4,1), [$1..1000]):
    L[2..-1]-L[1..-2]; # Robert Israel, Dec 08 2016
  • Mathematica
    Differences@ Select[Range@ 208, Length@ PowersRepresentations[#^2, 2, 2] > 1 &] (* Michael De Vlieger, Nov 25 2016, after Alonso del Arte at A009003 *)

Formula

a(n) = A009003(n+1) - A009003(n).

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

A350040 Number of integer-sided right triangles with hypotenuse A009003(n).

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 2, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 1, 1, 2, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 4, 1, 2
Offset: 1

Views

Author

Wesley Ivan Hurt, Dec 11 2021

Keywords

Comments

a(n) mod 3 = 1 for 95.3% of the first 13211 terms, including the 70% where a(n) = 1, and only 4.7% account for the other numbers. Theorem 7 of A. Tripathi (see link below) provides the explanation that 2, 3, 5, 6, etc. are so rare. The term 8 will appear for the first time when the hypotenuse is A006339(8) = 390625. - Ruediger Jehn, Jan 13 2022
All positive integers eventually appear in this sequence. - Charles R Greathouse IV, Jan 13 2022
The normal value of a(n) is roughly log(n)^(log(3)/2). For any fixed k, the asymptotic density of n such that a(n) <= k is 0. The typical a(n) is of the form (x*3^y-1)/2 with x small (because most numbers have only a few primes with exponents > 1). - Charles R Greathouse IV, Jan 13 2022

Crossrefs

Programs

  • PARI
    is_A009003(n)=setsearch(Set(factor(n)[, 1]%4), 1);
    f(n) = {my(f = factor(n/(2^valuation(n, 2)))); (prod(k=1, #f~, if ((f[k, 1] % 4) == 1, 2*f[k, 2] + 1, 1)) - 1)/2; } \\ A046080
    lista(nn) = apply(f, select(is_A009003, [1..nn])); \\ Michel Marcus, Jan 13 2022
    
  • PARI
    A046080(n,f=factor(n))=prod(k=if(f[1,1]==2,2,1), #f~, if (f[k,1]%4 == 1, 2*f[k,2] + 1, 1))\2; \\ doesn't handle n = 1, not relevant here
    upto(lim)=my(v=List(),u=vectorsmall(lim\=1)); forprimestep(p=5,lim,4, forstep(n=p,lim,p, u[n]=1)); forfactored(n=5,lim, if(u[n[1]], listput(v, A046080(0,n[2])))); u=0; Vec(v) \\ Charles R Greathouse IV, Jan 13 2022
    
  • PARI
    upto(lim)=my(v=List()); forfactored(n=5,lim\=1, if(vecmin(n[2][,1]%4)==1, listput(v, prod(k=if(n[2][1,1]>2,1,2),#n[2]~, if (n[2][k,1]%4 == 1, 2*n[2][k,2] + 1, 1))\2))); Vec(v) \\ Charles R Greathouse IV, Jan 13 2022

A002144 Pythagorean primes: primes of the form 4*k + 1.

Original entry on oeis.org

5, 13, 17, 29, 37, 41, 53, 61, 73, 89, 97, 101, 109, 113, 137, 149, 157, 173, 181, 193, 197, 229, 233, 241, 257, 269, 277, 281, 293, 313, 317, 337, 349, 353, 373, 389, 397, 401, 409, 421, 433, 449, 457, 461, 509, 521, 541, 557, 569, 577, 593, 601, 613, 617
Offset: 1

Views

Author

Keywords

Comments

Rational primes that decompose in the field Q(sqrt(-1)). - N. J. A. Sloane, Dec 25 2017
These are the prime terms of A009003.
-1 is a quadratic residue mod a prime p if and only if p is in this sequence.
Sin(a(n)*Pi/2) = 1 with Pi = 3.1415..., see A070750. - Reinhard Zumkeller, May 04 2002
If at least one of the odd primes p, q belongs to the sequence, then either both or neither of the congruences x^2 = p (mod q), x^2 = q (mod p) are solvable, according to Gauss reciprocity law. - Lekraj Beedassy, Jul 17 2003
Odd primes such that binomial(p-1, (p-1)/2) == 1 (mod p). - Benoit Cloitre, Feb 07 2004
Primes that are the hypotenuse of a right triangle with integer sides. The Pythagorean triple is {A002365(n), A002366(n), a(n)}.
Also, primes of the form a^k + b^k, k > 1. - Amarnath Murthy, Nov 17 2003
The square of a(n) is the average of two other squares. This fact gives rise to a class of monic polynomials x^2 + bx + c with b = a(n) that will factor over the integers regardless of the sign of c. See A114200. - Owen Mertens (owenmertens(AT)missouristate.edu), Nov 16 2005
Also such primes p that the last digit is always 1 for the Nexus numbers of form n^p - (n-1)^p. - Alexander Adamchuk, Aug 10 2006
The set of Pythagorean primes is a proper subset of the set of positive fundamental discriminants (A003658). - Paul Muljadi, Mar 28 2008
A079260(a(n)) = 1; complement of A137409. - Reinhard Zumkeller, Oct 11 2008
From Artur Jasinski, Dec 10 2008: (Start)
If we take 4 numbers: 1, A002314(n), A152676(n), A152680(n) then multiplication table modulo a(n) is isomorphic to the Latin square:
1 2 3 4
2 4 1 3
3 1 4 2
4 3 2 1
and isomorphic to the multiplication table of {1, i, -i, -1} where i is sqrt(-1), A152680(n) is isomorphic to -1, A002314(n) with i or -i and A152676(n) vice versa -i or i. 1, A002314(n), A152676(n), A152680(n) are subfield of Galois field [a(n)]. (End)
Primes p such that the arithmetic mean of divisors of p^3 is an integer. There are 2 sequences of such primes: this one and A002145. - Ctibor O. Zizka, Oct 20 2009
Equivalently, the primes p for which the smallest extension of F_p containing the square roots of unity (necessarily F_p) contains the 4th roots of unity. In this respect, the n = 2 case of a family of sequences: see n=3 (A129805) and n=5 (A172469). - Katherine E. Stange, Feb 03 2010
Subsequence of A007969. - Reinhard Zumkeller, Jun 18 2011
A151763(a(n)) = 1.
k^k - 1 is divisible by 4*k + 1 if 4*k + 1 is a prime (see Dickson reference). - Gary Detlefs, May 22 2013
Not only are the squares of these primes the sum of two nonzero squares, but the primes themselves are also. 2 is the only prime equal to the sum of two nonzero squares and whose square is not. 2 is therefore not a Pythagorean prime. - Jean-Christophe Hervé, Nov 10 2013
The statement that these primes are the sum of two nonzero squares follows from Fermat's theorem on the sum of two squares. - Jerzy R Borysowicz, Jan 02 2019
The decompositions of the prime and its square into two nonzero squares are unique. - Jean-Christophe Hervé, Nov 11 2013. See the Dickson reference, Vol. II, (B) on p. 227. - Wolfdieter Lang, Jan 13 2015
p^e for p prime of the form 4*k+1 and e >= 1 is the sum of 2 nonzero squares. - Jon Perry, Nov 23 2014
Primes p such that the area of the isosceles triangle of sides (p, p, q) for some integer q is an integer. - Michel Lagneau, Dec 31 2014
This is the set of all primes that are the average of two squares. - Richard R. Forberg, Mar 01 2015
Numbers k such that ((k-3)!!)^2 == -1 (mod k). - Thomas Ordowski, Jul 28 2016
This is a subsequence of primes of A004431 and also of A016813. - Bernard Schott, Apr 30 2022
In addition to the comment from Jean-Christophe Hervé, Nov 10 2013: All powers as well as the products of any of these primes are the sum of two nonzero squares. They are terms of A001481, which is closed under multiplication. - Klaus Purath, Nov 19 2023

Examples

			The following table shows the relationship between several closely related sequences:
Here p = A002144 = primes == 1 (mod 4), p = a^2+b^2 with a < b;
a = A002331, b = A002330, t_1 = ab/2 = A070151;
p^2 = c^2 + d^2 with c < d; c = A002366, d = A002365,
t_2 = 2ab = A145046, t_3 = b^2 - a^2 = A070079,
with {c,d} = {t_2, t_3}, t_4 = cd/2 = ab(b^2-a^2).
  ---------------------------------
   p  a  b  t_1  c   d t_2 t_3  t_4
  ---------------------------------
   5  1  2   1   3   4   4   3    6
  13  2  3   3   5  12  12   5   30
  17  1  4   2   8  15   8  15   60
  29  2  5   5  20  21  20  21  210
  37  1  6   3  12  35  12  35  210
  41  4  5  10   9  40  40   9  180
  53  2  7   7  28  45  28  45  630
  ...
a(7) = 53 = A002972(7)^2 + (2*A002973(7))^2 = 7^2 + (2*1)^2 = 49 + 4, and this is the only way. - _Wolfdieter Lang_, Jan 13 2015
		

References

  • David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
  • L. E. Dickson, "History of the Theory of Numbers", Chelsea Publishing Company, 1919, Vol I, page 386
  • L. E. Dickson, History of the Theory of Numbers, Carnegie Institution, Publ. No. 256, Vol. II, Washington D.C., 1920, p. 227.
  • G. H. Hardy, Ramanujan: twelve lectures on subjects suggested by his life and work, Cambridge, University Press, 1940, p. 132.
  • M. du Sautoy, The Music of the Primes, Fourth Estate / HarperCollins, 2003; see p. 76.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, pages 241, 243.
  • David Wells, The Penguin Dictionary of Curious and Interesting Numbers. Penguin Books, NY, 1986, Revised edition 1987. See p. 90.

Crossrefs

Cf. A004613 (multiplicative closure).
Apart from initial term, same as A002313.
For values of n see A005098.
Primes in A020668.

Programs

  • Haskell
    a002144 n = a002144_list !! (n-1)
    a002144_list = filter ((== 1) . a010051) [1,5..]
    -- Reinhard Zumkeller, Mar 06 2012, Feb 22 2011
    
  • Magma
    [a: n in [0..200] | IsPrime(a) where a is 4*n + 1 ]; // Vincenzo Librandi, Nov 23 2014
    
  • Maple
    a := []; for n from 1 to 500 do if isprime(4*n+1) then a := [op(a),4*n+1]; fi; od: A002144 := n->a[n];
    # alternative
    A002144 := proc(n)
        option remember ;
        local a;
        if n = 1 then
            5;
        else
            for a from procname(n-1)+4 by 4 do
                if isprime(a) then
                    return a;
                end if;
            end do:
        end if;
    end proc:
    seq(A002144(n),n=1..100) ; # R. J. Mathar, Jan 31 2024
  • Mathematica
    Select[4*Range[140] + 1, PrimeQ[ # ] &] (* Stefan Steinerberger, Apr 16 2006 *)
    Select[Prime[Range[150]],Mod[#,4]==1&] (* Harvey P. Dale, Jan 28 2021 *)
  • PARI
    select(p->p%4==1,primes(1000))
    
  • PARI
    A002144_next(p=A2144[#A2144])={until(isprime(p+=4),);p} /* NB: p must be of the form 4k+1. Beyond primelimit, this is *much* faster than forprime(p=...,, p%4==1 && return(p)). */
    A2144=List(5); A002144(n)={while(#A2144A002144_next())); A2144[n]}
    \\ M. F. Hasler, Jul 06 2024
    
  • Python
    from sympy import prime
    A002144 = [n for n in (prime(x) for x in range(1,10**3)) if not (n-1) % 4]
    # Chai Wah Wu, Sep 01 2014
    
  • Python
    from sympy import isprime
    print(list(filter(isprime, range(1, 618, 4)))) # Michael S. Branicky, May 13 2021
    
  • SageMath
    def A002144_list(n): # returns all Pythagorean primes <= n
        return [x for x in prime_range(5,n+1) if x % 4 == 1]
    A002144_list(617) # Peter Luschny, Sep 12 2012

Formula

Odd primes of form x^2 + y^2, (x=A002331, y=A002330, with x < y) or of form u^2 + 4*v^2, (u = A002972, v = A002973, with u odd). - Lekraj Beedassy, Jul 16 2004
p^2 - 1 = 12*Sum_{i = 0..floor(p/4)} floor(sqrt(i*p)) where p = a(n) = 4*n + 1. [Shirali]
a(n) = A000290(A002972(n)) + A000290(2*A002973(n)) = A000290(A002331(n+1)) + A000290(A002330(n+1)). - Reinhard Zumkeller, Feb 16 2010
a(n) = A002972(n)^2 + (2*A002973(n))^2, n >= 1. See the Jean-Christophe Hervé Nov 11 2013 comment. - Wolfdieter Lang, Jan 13 2015
a(n) = 4*A005098(n) + 1. - Zak Seidov, Sep 16 2018
From Vaclav Kotesovec, Apr 30 2020: (Start)
Product_{k>=1} (1 - 1/a(k)^2) = A088539.
Product_{k>=1} (1 + 1/a(k)^2) = A243380.
Product_{k>=1} (1 - 1/a(k)^3) = A334425.
Product_{k>=1} (1 + 1/a(k)^3) = A334424.
Product_{k>=1} (1 - 1/a(k)^4) = A334446.
Product_{k>=1} (1 + 1/a(k)^4) = A334445.
Product_{k>=1} (1 - 1/a(k)^5) = A334450.
Product_{k>=1} (1 + 1/a(k)^5) = A334449. (End)
From Vaclav Kotesovec, May 05 2020: (Start)
Product_{k>=1} (1 + 1/A002145(k)) / (1 + 1/a(k)) = Pi/(4*A064533^2) = 1.3447728438248695625516649942427635670667319092323632111110962...
Product_{k>=1} (1 - 1/A002145(k)) / (1 - 1/a(k)) = Pi/(8*A064533^2) = 0.6723864219124347812758324971213817835333659546161816055555481... (End)
Sum_{k >= 1} 1/a(k)^s = (1/2) * Sum_{n >= 1 odd numbers} moebius(n) * log((2*n*s)! * zeta(n*s) * abs(EulerE(n*s - 1)) / (Pi^(n*s) * 2^(2*n*s) * BernoulliB(2*n*s) * (2^(n*s) + 1) * (n*s - 1)!))/n, s >= 3 odd number. - Dimitris Valianatos, May 21 2020
Legendre symbol (-1, a(n)) = +1, for n >= 1. - Wolfdieter Lang, Mar 03 2021

A000404 Numbers that are the sum of 2 nonzero squares.

Original entry on oeis.org

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

Views

Author

Keywords

Comments

From the formula it is easy to see that if k is in this sequence, then so are all odd powers of k. - T. D. Noe, Jan 13 2009
Also numbers whose cubes are the sum of two nonzero squares. - Joe Namnath and Lawrence Sze
A line perpendicular to y=mx has its first integral y-intercept at a^2+b^2. The remaining ones for that slope are multiples of that primitive value. - Larry J Zimmermann, Aug 19 2010
The primes in this sequence are sequence A002313.
Complement of A018825; A025426(a(n)) > 0; A063725(a(n)) > 0. - Reinhard Zumkeller, Aug 16 2011
If the two squares are not equal, then any power is still in the sequence: if k = x^2 + y^2 with x != y, then k^2 = (x^2-y^2)^2 + (2xy)^2 and k^3 = (x(x^2-3y^2))^2 + (y(3x^2-y^2))^2, etc. - Carmine Suriano, Jul 13 2012
There are never more than 3 consecutive terms that differ by 1. Triples of consecutive terms that differ by 1 occur infinitely many times, for example, 2(k^2 + k)^2, (k^2 - 1)^2 + (k^2 + 2 k)^2, and (k^2 + k - 1)^2 + (k^2 + k + 1)^2 for any integer k > 1. - Ivan Neretin, Mar 16 2017 [Corrected by Jerzy R Borysowicz, Apr 14 2017]
Number of terms less than 10^k, k=1,2,3,...: 3, 34, 308, 2690, 23873, 215907, 1984228, ... - Muniru A Asiru, Feb 01 2018
The squares in this sequence are the squares of the so-called hypotenuse numbers A009003. - M. F. Hasler, Jun 20 2025

Examples

			25 = 3^2 + 4^2, therefore 25 is a term. Note that also 25^3 = 15625 = 44^2 + 117^2, therefore 15625 is a term.
		

References

  • David A. Cox, "Primes of the Form x^2 + n y^2", Wiley, 1989.
  • GCHQ, The GCHQ Puzzle Book, Penguin, 2016. See page 103.
  • E. Grosswald, Representations of Integers as Sums of Squares. Springer-Verlag, NY, 1985, p. 75, Theorem 4, with Theorem 2, p. 15.
  • G. H. Hardy and E. M. Wright, An Introduction to the Theory of Numbers, 5th ed., Oxford Univ. Press, 1979, p. 219, th. 251, 252.
  • Ian Stewart, "Game, Set and Math", Chapter 8, 'Close Encounters of the Fermat Kind', Penguin Books, Ed. 1991, pp. 107-124.

Crossrefs

A001481 gives another version (allowing for zero squares).
Cf. A004431 (2 distinct squares), A063725 (number of representations), A024509 (numbers with multiplicity), A025284, A018825. Also A050803, A050801, A001105, A033431, A084888, A000578, A000290, A057961, A232499, A007692.
Cf. A003325 (analog for cubes), A003336 (analog for 4th powers).
Cf. A009003 (square roots of the squares in this sequence).
Column k=2 of A336725.

Programs

  • GAP
    P:=List([1..10^4],i->i^2);;
    A000404 := Set(Flat(List(P, i->List(P, j -> i+j)))); # Muniru A Asiru, Feb 01 2018
    
  • Haskell
    import Data.List (findIndices)
    a000404 n = a000404_list !! (n-1)
    a000404_list = findIndices (> 0) a025426_list
    -- Reinhard Zumkeller, Aug 16 2011
    
  • Magma
    lst:=[]; for n in [1..178] do f:=Factorization(n); if IsSquare(n) then for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 1 then Append(~lst, n); break; end if; end for; else t:=0; for m in [1..#f] do d:=f[m]; if d[1] mod 4 eq 3 and d[2] mod 2 eq 1 then t:=1; break; end if; end for; if t eq 0 then Append(~lst, n); end if; end if; end for; lst; // Arkadiusz Wesolowski, Feb 16 2017
    
  • Maple
    nMax:=178: A:={}: for i to floor(sqrt(nMax)) do for j to floor(sqrt(nMax)) do if i^2+j^2 <= nMax then A := `union`(A, {i^2+j^2}) else  end if end do end do: A; # Emeric Deutsch, Jan 02 2017
  • Mathematica
    nMax=1000; n2=Floor[Sqrt[nMax-1]]; Union[Flatten[Table[a^2+b^2, {a,n2}, {b,a,Floor[Sqrt[nMax-a^2]]}]]]
    Select[Range@ 200, Length[PowersRepresentations[#, 2, 2] /. {0, } -> Nothing] > 0 &] (* _Michael De Vlieger, Mar 24 2016 *)
    Module[{upto=200},Select[Union[Total/@Tuples[Range[Sqrt[upto]]^2,2]],#<= upto&]] (* Harvey P. Dale, Sep 18 2021 *)
  • PARI
    is_A000404(n)= for( i=1,#n=factor(n)~%4, n[1,i]==3 && n[2,i]%2 && return); n && ( vecmin(n[1,])==1 || (n[1,1]==2 && n[2,1]%2)) \\ M. F. Hasler, Feb 07 2009
    
  • PARI
    list(lim)=my(v=List(),x2); lim\=1; for(x=1,sqrtint(lim-1), x2=x^2; for(y=1,sqrtint(lim-x2), listput(v,x2+y^2))); Set(v) \\ Charles R Greathouse IV, Apr 30 2016
    
  • Python
    from itertools import count, islice
    from sympy import factorint
    def A000404_gen(startvalue=1): # generator of terms >= startvalue
        for n in count(max(startvalue,1)):
            c = False
            for p in (f:=factorint(n)):
                if (q:= p & 3)==3 and f[p]&1:
                    break
                elif q == 1:
                    c = True
            else:
                if c or f.get(2,0)&1:
                    yield n
    A000404_list = list(islice(A000404_gen(),30)) # Chai Wah Wu, Jul 01 2022

Formula

Let k = 2^t * p_1^a_1 * p_2^a_2 * ... * p_r^a_r * q_1^b_1 * q_2^b_2 * ... * q_s^b_s with t >= 0, a_i >= 0 for i=1..r, where p_i == 1 (mod 4) for i=1..r and q_j == -1 (mod 4) for j=1..s. Then k is a term iff 1) b_j == 0 (mod 2) for j=1..s and 2) r > 0 or t == 1 (mod 2) (or both).
From Charles R Greathouse IV, Nov 18 2022: (Start)
a(n) ~ k*n*sqrt(log n), where k = 1.3085... = 1/A064533.
There are B(x) = (x/sqrt(log x)) * (K + B2/log x + O(1/log^2 x)) terms of this sequence up to x, where K = A064533 and B2 = A227158. (End)

Extensions

Edited by Ralf Stephan, Nov 15 2004
Typo in formula corrected by M. F. Hasler, Feb 07 2009
Erroneous Mathematica program fixed by T. D. Noe, Aug 07 2009
PARI code fixed for versions > 2.5 by M. F. Hasler, Jan 01 2013

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
Showing 1-10 of 77 results. Next