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.

A020884 Ordered short legs of primitive Pythagorean triangles.

Original entry on oeis.org

3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19, 20, 20, 21, 23, 24, 25, 27, 28, 28, 29, 31, 32, 33, 33, 35, 36, 36, 37, 39, 39, 40, 41, 43, 44, 44, 45, 47, 48, 48, 49, 51, 51, 52, 52, 53, 55, 56, 57, 57, 59, 60, 60, 60, 61, 63, 64, 65, 65, 67, 68, 68, 69, 69, 71, 72, 73, 75, 75, 76, 76, 77
Offset: 1

Views

Author

Keywords

Comments

Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence gives values of A, sorted.
Union of A081874 and A081925. - Lekraj Beedassy, Jul 28 2006
Each term in this sequence is given by f(m,n) = m^2 - n^2 or g(m,n) = 2mn where m and n are relatively prime positive integers with m > n, m and n not both odd. For example, a(1) = f(2,1) = 2^2 - 1^2 = 3 and a(4) = g(4,1) = 2*4*1 = 8. - Agola Kisira Odero, Apr 29 2016
All powers of 2 greater than 4 (2^2) are terms, and are generated by the function g(m,n) = 2mn. - Torlach Rush, Nov 08 2019

Crossrefs

Cf. A009004, A020882, A020883, A020885, A020886. Different from A024352.
Cf. A024359 (gives the number of times n occurs).
Cf. A037213.

Programs

  • Haskell
    a020884 n = a020884_list !! (n-1)
    a020884_list = f 1 1 where
       f u v | v > uu `div` 2        = f (u + 1) (u + 2)
             | gcd u v > 1 || w == 0 = f u (v + 2)
             | otherwise             = u : f u (v + 2)
             where uu = u ^ 2; w = a037213 (uu + v ^ 2)
    -- Reinhard Zumkeller, Nov 09 2012
  • Mathematica
    shortLegs = {}; amx = 99; Do[For[b = a + 1, b < (a^2/2), c = (a^2 + b^2)^(1/2); If[c == IntegerPart[c] && GCD[a, b, c] == 1, AppendTo[shortLegs, a]]; b = b + 2], {a, 3, amx}]; shortLegs (* Vladimir Joseph Stephan Orlovsky, Aug 07 2008 *)
    Take[Union[Sort/@({Times@@#,(Last[#]^2-First[#]^2)/2}&/@(Select[Subsets[Range[1,101,2],{2}],GCD@@#==1&]))][[;;,1]],80] (* Harvey P. Dale, Feb 06 2025 *)

Extensions

Extended and corrected by David W. Wilson

A024352 Numbers which are the difference of two positive squares, c^2 - b^2 with 1 <= b < c.

Original entry on oeis.org

3, 5, 7, 8, 9, 11, 12, 13, 15, 16, 17, 19, 20, 21, 23, 24, 25, 27, 28, 29, 31, 32, 33, 35, 36, 37, 39, 40, 41, 43, 44, 45, 47, 48, 49, 51, 52, 53, 55, 56, 57, 59, 60, 61, 63, 64, 65, 67, 68, 69, 71, 72, 73, 75, 76, 77, 79, 80, 81, 83, 84, 85, 87, 88, 89, 91, 92, 93, 95, 96
Offset: 1

Views

Author

Keywords

Comments

These are the solutions to the equation x^2 + xy = n where y mod 2 = 0, y is positive and x is any positive integer. - Andrew S. Plewe, Oct 19 2007
Ordered different terms of A120070 = 3, 8, 5, 15, 12, 7, ... (which contains two 15's, two 40's, and two 48's). Complement: A139544. (See A139491.) - Paul Curtz, Sep 01 2009
A024359(a(n)) > 0. - Reinhard Zumkeller, Nov 09 2012
If a(n) mod 6 = 3, n > 1, then a(n) = c^2 - f(a(n))^2 where f(n) = (floor(4*n/3) - 3 - n)/2. For example, 171 = 30^2 - 27^2 and f(171) = 27. - Gary Detlefs, Jul 15 2014

Crossrefs

Same as A042965 except for initial terms. - Michael Somos, Jun 08 2000
Different from A020884.

Programs

  • Haskell
    a024352 n = a024352_list !! (n-1)
    a024352_list = 3 : drop 4 a042965_list
    -- Reinhard Zumkeller, Nov 09 2012
    
  • Magma
    [3] cat [4 +Floor((4*n-3)/3): n in [2..100]]; // G. C. Greubel, Apr 22 2023
    
  • Mathematica
    Union[Flatten[Table[Select[Table[b^2 - c^2, {c, b-1}], # < 100 &], {b, 100}]]] (* Robert G. Wilson v, Jun 05 2004 *)
    LinearRecurrence[{1,0,1,-1},{3,5,7,8,9},70] (* Harvey P. Dale, Dec 20 2021 *)
  • PARI
    is(n)=(n%4!=2 && n>4) || n==3 \\ Charles R Greathouse IV, May 31 2013
    
  • Python
    def A024352(n): return 3 if n==1 else 3+(n<<2)//3 # Chai Wah Wu, Feb 10 2025
  • SageMath
    def A024352(n): return 4 + ((4*n-3)//3) - int(n==1)
    [A024352(n) for n in range(1,101)] # G. C. Greubel, Apr 22 2023
    

Formula

Consists of all positive integers except 1, 4 and numbers == 2 (mod 4).
a(n) = a(n-3) + 4, n > 4.
G.f.: (3 + 2*x + 2*x^2 - 2*x^3 - x^4)/(1 - x - x^3 + x^4). - Ralf Stephan, before May 13 2008
a(n) = a(n-1) + a(n-3) - a(n-4), for n > 5. - Ant King, Oct 03 2011
a(n) = 4 + floor((4*n-3)/3), n > 1. - Gary Detlefs, Jul 15 2014

Extensions

Edited by N. J. A. Sloane, Sep 19 2008

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

A139544 Numbers which are not the difference of two squares of positive integers.

Original entry on oeis.org

1, 2, 4, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42, 46, 50, 54, 58, 62, 66, 70, 74, 78, 82, 86, 90, 94, 98, 102, 106, 110, 114, 118, 122, 126, 130, 134, 138, 142, 146, 150, 154, 158, 162, 166, 170, 174, 178, 182, 186, 190, 194, 198, 202, 206, 210, 214, 218, 222, 226, 230
Offset: 1

Views

Author

Artur Jasinski, Apr 25 2008

Keywords

Comments

Conjecture: these numbers do not occur in A139491.
Complement sequence to A024352.
All odd numbers 2k+1 for k>0 can be represented by (k+1)^2-k^2. All multiples 4k for k>1 can be represented by (k+1)^2-(k-1)^2. No number of the form 4k+2 is the difference of two squares because, modulo 4, the differences of two squares are 0, 1, or 3. [T. D. Noe, Apr 27 2009]
A024359(a(n)) = 0. - Reinhard Zumkeller, Nov 09 2012

Crossrefs

Programs

  • Haskell
    a139544 n = a139544_list !! (n-1)
    a139544_list = 1 : 2 : 4 : tail a016825_list
    -- Reinhard Zumkeller, Nov 09 2012
    
  • Mathematica
    a[1] = 1; a[2] = 2; a[3] = 4; a[n_] := 4*n-10; Array[a, 60] (* Jean-François Alcover, May 27 2015 *)
  • PARI
    is(n)=n%4==2||n==1||n==4 \\ Charles R Greathouse IV, May 31 2013
    
  • Python
    def A139544(n): return 1<Chai Wah Wu, Feb 11 2025

Extensions

Corrected by T. D. Noe, Apr 27 2009

A024360 Number of primitive Pythagorean triangles with long leg n.

Original entry on oeis.org

0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0
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 B takes value n.
Number of times n occurs in A020883.

Crossrefs

Programs

  • Mathematica
    A[s_] := With[{s6 = StringPadLeft[ToString[s], 6, "0"]}, Cases[Import[ "https://oeis.org/A" <> s6 <> "/b" <> s6 <> ".txt", "Table"], {, }][[;; 10000, 2]]];
    A@024361 - A@024359 (* Jean-François Alcover, Mar 27 2020 *)

Formula

a(n) = A024361(n) - A024359(n). - Ray Chandler, Feb 03 2020

A132404 Smallest short legs 'A' of exactly n primitive Pythagorean triangles.

Original entry on oeis.org

3, 20, 60, 204, 5040, 420, 660, 2040
Offset: 1

Views

Author

Keywords

Comments

Where records occur in A024359. a(12) = 13860, a(13) = 4620, and a(14) = 7140. - T. D. Noe, Feb 23 2012
From Colin Barker, Oct 25 2015: (Start)
a(11) = 872100, a(15) = 22440 and a(16) = 55440.
a(9), a(10), a(17), a(18), a(19) and a(20) are not less than 6000000.
(End)

Examples

			The solutions for the first 7 are
1, (3,4,5)
2, (20,21,29), (20,99,101)
3, (60,91,109), (60,221,229), (60,899,901)
4, (204,253,325), (204,1147,1165), (204,2597,2605), (204,10403,10405)
5, (5040,78319,78481), (5040,99161,99289), (5040,129551,129649), (5040,253991,254041), (5040,6350399,6350401)
6, (420,851,949), (420,1189,1261), (420,1739,1789), (420,4891,4909), (420,11021,11029), (420,44099,44101)
7, (660,779,1021), (660,989,1189), (660,2989,3061), (660,4331,4381), (660,12091,12109), (660,27221,27229), (660,108899,108901)
		

Crossrefs

Cf. A024359.

Programs

  • Mathematica
    PyphagoreanAs[a_] := (q={}; k=0; If[a>=8,r=4,r=1]; Do[y=(a^2+b^2)^0.5; c=IntegerPart[y]; If[c==y, p=0; If[GCD[a,b,c]==1, AppendTo[q,a.b.c]; k++ ]], {b,a+1,a^2/r}]; PrependTo[q,k]; q); lst={}; x=0; Do[w=PyphagoreanAs[n][[1]]; If[w>x, Print[Date[],"A=",n,",w=",w]; AppendTo[lst,n]; x=w], {n,1000}]; lst
    solns[a_] := Module[{b, c, soln}, soln = Reduce[a^2 + b^2 == c^2 && a < b && c > 0 && GCD[a, b, c] == 1, {b, c}, Integers]; If[soln === False, 0, If[soln[[1, 1]] === b, 1, Length[soln]]]]; nn = 20; t = Table[0, {nn}]; Do[s = solns[n]; If[s > nn, Print[{s, n}], If[t[[s]] == 0, t[[s]] = n; Print[{s, n}]]], {n, 5040}]; t (* T. D. Noe, Feb 23 2012 *)

Extensions

a(5) from T. D. Noe, Feb 23 2012

A307706 Number of unitary divisors of n that are smaller than sqrt((sqrt(2) - 1)*n).

Original entry on oeis.org

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

Views

Author

Jianing Song, Apr 23 2019

Keywords

Comments

Related to A024359: (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 A024359(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), u > v and u^2 - v^2 < 2*u*v. Let s = u + v, t = u - v, then n = s*t, where s and t are unitary divisors of n, s > t and s*t < (s^2 - t^2)/2, so t is in the range (0, sqrt((sqrt(2) - 1)*n));
(b) if n is divisible by 4, then A024359(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), u > v and 2*u*v < u^2 - v^2. So u and v must be unitary divisors of n/2, and v is in the range (0, sqrt((sqrt(2) - 1)*(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 A024359(n) = 0.
Similarly, let b(n) be the number of unitary divisors of n in the range (sqrt((sqrt(2) - 1)*n), sqrt(n)) (= A034444(n)/2 - a(n) for n > 1), then the number of times B takes value n is b(n) for odd n > 1, b(n/2) if n is divisible by 4 and 0 if n = 1 or n == 2 (mod 4). (End)
For k >= 2, the earliest occurrence of k is at n = A132404(k)/2 if A132404(k) is even (and thus being a multiple of 4). Conjecture: this is always the case.

Examples

			The unitary divisors of 210 that are smaller than sqrt((sqrt(2) - 1)*210) = 9.3265... are 1, 2, 3, 5, 6 and 7, so a(210) = 6. Correspondingly, A024359(420) = 6.
		

Crossrefs

Programs

  • PARI
    a(n) = my(i=0); for(k=1, sqrt((sqrt(2)-1)*n), if(!(n%k) && gcd(k,n/k)==1, i++)); i

Formula

A024359(n) = a(n) for odd n; A024359(n) = a(n/2) for n divisible by 4.
Showing 1-7 of 7 results.