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-7 of 7 results.

A046079 Number of Pythagorean triangles with leg n.

Original entry on oeis.org

0, 0, 1, 1, 1, 1, 1, 2, 2, 1, 1, 4, 1, 1, 4, 3, 1, 2, 1, 4, 4, 1, 1, 7, 2, 1, 3, 4, 1, 4, 1, 4, 4, 1, 4, 7, 1, 1, 4, 7, 1, 4, 1, 4, 7, 1, 1, 10, 2, 2, 4, 4, 1, 3, 4, 7, 4, 1, 1, 13, 1, 1, 7, 5, 4, 4, 1, 4, 4, 4, 1, 12, 1, 1, 7, 4, 4, 4, 1, 10, 4, 1, 1, 13, 4, 1, 4, 7, 1, 7, 4, 4, 4, 1, 4, 13, 1, 2, 7
Offset: 1

Views

Author

Keywords

Comments

Number of ways in which n can be the leg (other than the hypotenuse) of a primitive or nonprimitive right triangle.
Number of ways that 2/n can be written as a sum of exactly two distinct unit fractions. For every solution to 2/n = 1/x + 1/y, x < y, the Pythagorean triple is (n, y-x, x+y-n). - T. D. Noe, Sep 11 2002
For n>2, the positions of the ones in this sequence correspond to the prime numbers and their doubles, A001751. - Ant King, Jan 29 2011
Let L = length of longest leg, H = hypotenuse. For odd n: L =(n^2-1)/2 and H = L+1. For even n, L = (n^2-4)/4 and H = L+2. - Richard R. Forberg, May 31 2013
Or number of ways n^2 can be written as the difference of two positive squares: a(3) = 1: 3^2 = 5^2-4^2; a(8) = 2: 8^2 = 10^2-6^2 = 17^2-15^2; a(16) = 3: 16^2 = 20^2-12^2 = 34^2-30^2 = 65^2-63^2. - Alois P. Heinz, Aug 06 2019
Number of ways to write 2n as the sum of two positive integers r and s such that r < s and (s - r) | (s * r). - Wesley Ivan Hurt, Apr 21 2020

References

  • Albert H. Beiler, Recreations in the Theory of Numbers. New York: Dover Publications, 1966, pp. 116-117.

Crossrefs

Programs

  • Mathematica
    a[n_] := (DivisorSigma[0, If[OddQ[n], n, n / 2]^2] - 1) / 2; Table[a[i], {i, 100}] (* Amber Hu (hupo001(AT)gmail.com), Jan 23 2008 *)
    a[ n_] := Length @ FindInstance[ n > 0 && y > 0 && z > 0 && n^2 + y^2 == z^2, {y, z}, Integers, 10^9]; (* Michael Somos, Jul 25 2018 *)
  • PARI
    A046079(n) = ((numdiv(if(n%2, n, n/2)^2)-1)/2); \\ Antti Karttunen, Sep 27 2018
    
  • Python
    from math import prod
    from sympy import factorint
    def A046079(n): return prod((e+(p&1)<<1)-1 for p,e in factorint(n).items())>>1 # Chai Wah Wu, Sep 06 2022
  • Sage
    def A046079(n) : return (number_of_divisors(n^2 if n%2==1 else n^2/4) - 1) // 2 # Eric M. Schmidt, Jan 26 2013
    

Formula

For odd n, a(n) = A018892(n) - 1.
Let n = (2^a0)*(p1^a1)*...*(pk^ak). Then a(n) = [(2*a0 - 1)*(2*a1 + 1)*(2*a2 + 1)*(2*a3 + 1)*...*(2*ak + 1) - 1]/2. Note that if there is no a0 term, i.e., if n is odd, then the first term is simply omitted. - Temple Keller (temple.keller(AT)gmail.com), Jan 05 2008
For odd n, a(n) = (tau(n^2) - 1) / 2; for even n, a(n) = (tau((n / 2)^2) - 1) / 2. - Amber Hu (hupo001(AT)gmail.com), Jan 23 2008
a(n) = Sum_{i=1..n-1} (1 - ceiling(i*(2*n-i)/(2*n-2*i)) + floor(i*(2*n-i)/(2*n-2*i))). - Wesley Ivan Hurt, Apr 21 2020
Sum_{k=1..n} a(k) ~ (n / Pi^2) * (log(n)^2 + c_1 * log(n) + c_2), where c_1 = 2 * (gamma - 1) + 48*log(A) - 4*log(Pi) - 13*log(2)/3 = 3.512088... (gamma = A001620, log(A) = A225746), and c_2 = 6 * gamma^2 - (6 + log(2)) * gamma + 2 - Pi^2/2 + 19*log(2)^2/18 + log(2)/3 - 6*gamma_1 + 8 * (zeta'(2)/zeta(2))^2 + (4 - 12*gamma + 2*log(2)/3) * zeta'(2)/zeta(2) - 4*zeta''(2)/zeta(2) = -4.457877... (gamma_1 = -A082633). - Amiram Eldar, Nov 08 2024

A046081 Number of integer-sided right triangles with n as a hypotenuse or leg.

Original entry on oeis.org

0, 0, 1, 1, 2, 1, 1, 2, 2, 2, 1, 4, 2, 1, 5, 3, 2, 2, 1, 5, 4, 1, 1, 7, 4, 2, 3, 4, 2, 5, 1, 4, 4, 2, 5, 7, 2, 1, 5, 8, 2, 4, 1, 4, 8, 1, 1, 10, 2, 4, 5, 5, 2, 3, 5, 7, 4, 2, 1, 14, 2, 1, 7, 5, 8, 4, 1, 5, 4, 5, 1, 12, 2, 2, 9, 4, 4, 5, 1, 11, 4, 2, 1, 13, 8, 1, 5, 7, 2, 8, 5, 4, 4, 1, 5, 13, 2, 2, 7
Offset: 1

Views

Author

Keywords

Comments

Pythagorean triples including primitive ones and non-primitive ones. For a certain n, it may be a leg or the hypotenuse in either a primitive Pythagorean triple, or a non-primitive Pythagorean triple, or both. - Rui Lin, Nov 02 2019

Examples

			From _Rui Lin_, Nov 02 2019: (Start)
n=25 is the least number which meets all of following cases:
1. 25 is a leg of a primitive Pythagorean triple (25,312,313), so A024361(25)=1;
2. 25 is the hypotenuse of a primitive Pythagorean triple (7,24,25), so A024362(25)=1;
3. 25 is a leg of a non-primitive Pythagorean triple (25,60,65), so A328708(25)=1;
4. 25 is the hypotenuse of a non-primitive Pythagorean triple (15,20,25), so A328712(25)=1;
5. Combination 1. and 3. means A046079(25)=2;
6. Combination 2. and 4. means A046080(25)=2;
7. Combination 1. and 2. means A024363(25)=2;
8. Combination 3. and 4. means A328949(25)=2;
9. Combination of 1., 2., 3., and 4. means A046081(25)=4. (End)
		

References

  • A. Beiler, Recreations in the Theory of Numbers. New York: Dover, pp. 116-117, 1966.

Crossrefs

Programs

  • Mathematica
    a[1] = 0; a[n_] := Module[{f}, f = Select[FactorInteger[n], Mod[#[[1]], 4] == 1&][[All, 2]]; (DivisorSigma[0, If[OddQ[n], n, n/2]^2]-1)/2 + (Times @@ (2*f+1) - 1)/2]; Array[a, 99] (* Jean-François Alcover, Jul 19 2017 *)
  • PARI
    a(n) = {oddn = n/(2^valuation(n, 2)); f = factor(oddn); for (k=1, #f~, if ((f[k,1] % 4) != 1, f[k,2] = 0);); n1 = factorback(f); if (n % 2, (numdiv(n^2)+numdiv(n1^2))/2 -1, (numdiv((n/2)^2)+numdiv(n1^2))/2 -1);} \\ Michel Marcus, Mar 07 2016
    
  • Python
    from sympy import factorint
    def a(n):
        p1, p2 = 1, 1
        for i in factorint(n).items():
            if i[0] % 4 == 1:
                p2 *= i[1] * 2 + 1
            p1 *= i[1] * 2 + 1 - (2 if i[0] == 2 else 0)
        return (p1 + p2)//2 - 1
    print([a(n) for n in range(1, 100)])  # Oleg Sorokin, Mar 02 2023

Formula

a(n) = A046079(n) + A046080(n). - Lekraj Beedassy, Dec 01 2003
From Rui Lin, Nov 02 2019: (Start)
a(n) = A024363(n) + A328949(n).
a(n) = A024361(n) + A024362(n) + A328708(n) + A328712(n). (End)

Extensions

Improved name by Bernard Schott, Jan 03 2019

A024361 Number of primitive Pythagorean triangles with leg n.

Original entry on oeis.org

0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 2, 1, 1, 0, 1, 2, 2, 0, 1, 2, 1, 0, 1, 2, 1, 0, 1, 1, 2, 0, 2, 2, 1, 0, 2, 2, 1, 0, 1, 2, 2, 0, 1, 2, 1, 0, 2, 2, 1, 0, 2, 2, 2, 0, 1, 4, 1, 0, 2, 1, 2, 0, 1, 2, 2, 0, 1, 2, 1, 0, 2, 2, 2, 0, 1, 2, 1, 0, 1, 4, 2, 0, 2, 2, 1, 0, 2, 2, 2, 0, 2, 2, 1, 0, 2, 2, 1, 0, 1, 2, 4
Offset: 1

Views

Author

Keywords

Comments

Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence gives number of times A or B takes value n.
For n > 1, a(n) = 0 for n == 2 (mod 4) (n in A016825).
From Jianing Song, Apr 23 2019: (Start)
Note that all the primitive Pythagorean triangles are given by A = min{2*u*v, u^2 - v^2}, B = max{2*u*v, u^2 - v^2}, C = u^2 + v^2, where u, v are coprime positive integers, u > v and u - v is odd. As a result:
(a) if n is odd, then a(n) is the number of representations of n to the form n = u^2 - v^2, where u, v are coprime positive integers (note that this guarantees that u - v is odd) and u > v. Let s = u + v, t = u - v, then n = s*t, where s and t are unitary divisors of n and s > t, so the number of representations is A034444(n)/2 if n > 1 and 0 if n = 1;
(b) if n is divisible by 4, then a(n) is the number of representations of n to the form n = 2*u*v, where u, v are coprime positive integers (note that this also guarantees that u - v is odd because n/2 is even) and u > v. So u and v must be unitary divisors of n/2, so the number of representations is A034444(n/2)/2. Since n is divisible by 4, A034444(n/2) = A034444(n) so a(n) = A034444(n)/2.
(c) if n == 2 (mod 4), then n/2 is odd, so n = 2*u*v implies that u and v are both odd, which is not acceptable, so a(n) = 0.
a(n) = 0 if n = 1 or n == 2 (mod 4), otherwise a(n) is a power of 2.
The earliest occurrence of 2^k is 2*A002110(k+1) for k > 0. (End)

Examples

			a(12) = 2 because 12 appears twice, in (A,B,C) = (5,12,13) and (12,35,37).
		

Crossrefs

Programs

  • Mathematica
    Table[If[n == 1 || Mod[n, 4] == 2, 0, 2^(Length[FactorInteger[n]] - 1)], {n, 100}]
  • PARI
    A024361(n) = if(1==n||(2==(n%4)),0,2^(omega(n)-1)); \\ (after the Mathematica program) - Antti Karttunen, Nov 10 2018

Formula

a(n) = A034444(n)/2 = 2^(A001221(n)-1) if n != 2 (mod 4) and n > 1, a(n) = 0 otherwise. - Jianing Song, Apr 23 2019
a(n) = A024359(n) + A024360(n). - Ray Chandler, Feb 03 2020

Extensions

Incorrect comment removed by Ant King, Jan 28 2011
More terms from Antti Karttunen, Nov 10 2018

A379830 a(n) is the number of Pythagorean triples (u, v, w) for which w - u = n where u < v < w.

Original entry on oeis.org

0, 0, 1, 0, 1, 0, 1, 0, 2, 2, 1, 0, 1, 0, 1, 0, 2, 0, 4, 0, 1, 0, 1, 0, 2, 3, 1, 2, 1, 0, 1, 0, 5, 0, 1, 0, 4, 0, 1, 0, 2, 0, 1, 0, 1, 2, 1, 0, 2, 4, 7, 0, 1, 0, 4, 0, 2, 0, 1, 0, 1, 0, 1, 2, 5, 0, 1, 0, 1, 0, 1, 0, 8, 0, 1, 3, 1, 0, 1, 0, 2, 6, 1, 0, 1, 0, 1, 0
Offset: 0

Views

Author

Felix Huber, Jan 07 2025

Keywords

Comments

The difference between the hypotenuse and the short leg of a primitive Pythagorean triple (p^2 - q^2, 2*p*q, p^2 + q^2) (where p > q are coprimes and not both odd) is d = max(2*q^2, (p - q)^2). For every of these primitive Pythagorean triples whose d divides n, there is a Pythagorean triple with w - u = n. Therefore d <= n and it follows that 1 <= q <= sqrt(n/2) and q + 1 <= p <= q + sqrt(n), which means that there is a finite number of Pythagorean triples with w - u = n.

Examples

			The a(18) = 4 Pythagorean triples are (27, 36, 45), (16, 30, 34), (40, 42, 58), (7, 24, 25) because 45 - 27 = 34 - 16 = 58 - 40 = 25 - 7 = 18.
See also linked Maple program "Pythagorean triples for which w - u = n".
		

Crossrefs

Programs

  • Maple
    A379830:=proc(n)
        local a,p,q;
        a:=0;
        for q to isqrt(floor(n/2)) do
            for p from q+1 to q+isqrt(n) do
                if igcd(p,q)=1 and (is(p,even) or is(q,even)) and n mod max((p-q)^2,2*q^2)=0 then
                    a:=a+1
                fi
            od
        od;
        return a
    end proc;
    seq(A379830(n),n=0..87);

A328949 Number of non-primitive Pythagorean triples with n as a leg or the hypotenuse.

Original entry on oeis.org

0, 0, 0, 0, 0, 1, 0, 1, 1, 2, 0, 2, 0, 1, 3, 2, 0, 2, 0, 3, 2, 1, 0, 5, 2, 2, 2, 2, 0, 5, 0, 3, 2, 2, 3, 5, 0, 1, 3, 6, 0, 4, 0, 2, 6, 1, 0, 8, 1, 4, 3, 3, 0, 3, 3, 5, 2, 2, 0, 10, 0, 1, 5, 4, 4, 4, 0, 3, 2, 5, 0, 10, 0, 2, 7, 2, 2, 5, 0, 9, 3, 2, 0, 9, 4, 1, 3, 5, 0, 8, 3, 2, 2, 1, 3, 11, 0, 2, 5, 7
Offset: 1

Views

Author

Rui Lin, Nov 01 2019

Keywords

Comments

Pythagorean triples including primitive ones and non-primitive ones. For a certain n, it may be a leg or the hypotenuse in either a primitive Pythagorean triple, or a non-primitive Pythagorean triple, or both.
This sequence is the count of n as a leg or the hypotenuse in non-primitive Pythagorean triples.

Examples

			For n=10, 10 is a leg in (10,24,26) and the hypotenuse in (6,8,10), so a(10)=A328708(10)+A328712(10)=1+1=2. And 10 is not a leg or the hypotenuse in any primitive Pythagorean triple, a(10)=A046081(10)-A024363(10)=2-0=2.
		

References

  • A. Beiler, Recreations in the Theory of Numbers. New York: Dover Publications, pp. 116-117, 1966.

Crossrefs

Programs

  • Mathematica
    a[n_] := Count[{x, y} /. Solve[(x^2 + y^2 == n^2 || x^2 - y^2 == n^2) && x > y > 0, {x, y}, Integers], p_ /; GCD @@ p > 1]; Array[a, 100] (* Giovanni Resta, Nov 01 2019 *)

Formula

a(n) = A328708(n) + A328712(n).
a(n) = A046081(n) - A024363(n).

A110133 Numbers which are the sides that belong to only one primitive Pythagorean triangle.

Original entry on oeis.org

3, 4, 7, 8, 9, 11, 16, 19, 23, 27, 31, 32, 43, 47, 49, 59, 64, 67, 71, 79, 81, 83, 103, 107, 121, 127, 128, 131, 139, 151, 163, 167, 179, 191, 199, 211, 223, 227, 239, 243, 251, 256, 263, 271, 283, 307, 311, 331, 343, 347, 359, 361, 367, 379, 383, 419, 431, 439
Offset: 1

Views

Author

Lekraj Beedassy, Jul 13 2005

Keywords

Comments

Powers of 2 starting with 2^2=4 and powers of primes of form 4k+3; none is a hypotenuse. - Ray Chandler, Jul 21 2005
Along with 2, the natural numbers that are Gaussian prime powers. Morgan L. Owens, Nov 21 2014

Crossrefs

Extensions

Extended by Ray Chandler, Jul 21 2005

A110134 Numbers which are the sides common to two or more primitive Pythagorean triangles.

Original entry on oeis.org

5, 12, 13, 15, 17, 20, 21, 24, 25, 28, 29, 33, 35, 36, 37, 39, 40, 41, 44, 45, 48, 51, 52, 53, 55, 56, 57, 60, 61, 63, 65, 68, 69, 72, 73, 75, 76, 77, 80, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96, 97, 99, 100, 101, 104, 105, 108, 109, 111, 112, 113, 115, 116, 117, 119, 120
Offset: 1

Views

Author

Lekraj Beedassy, Jul 13 2005

Keywords

Crossrefs

Extensions

Extended by Ray Chandler, Jul 21 2005
Showing 1-7 of 7 results.