A024359 Number of primitive Pythagorean triangles with short leg n.
0, 0, 1, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 1, 1, 1, 0, 1, 2, 1, 0, 1, 1, 2, 0, 1, 2, 1, 0, 2, 1, 1, 0, 1, 2, 1, 0, 1, 2, 1, 0, 2, 2, 1, 0, 1, 1, 2, 0, 1, 3, 1, 0, 1, 1, 2, 0, 1, 2, 2, 0, 1, 1, 1, 0, 2, 2, 1, 0, 1, 1, 1, 0, 1, 3, 2, 0, 2
Offset: 1
Keywords
Links
- T. D. Noe, Table of n, a(n) for n = 1..10000
- Ron Knott, Pythagorean Triples and Online Calculators
Programs
-
Haskell
a024359_list = f 0 1 a020884_list where f c u vs'@(v:vs) | u == v = f (c + 1) u vs | u /= v = c : f 0 (u + 1) vs' -- Reinhard Zumkeller, Nov 09 2012
-
Mathematica
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]]]]; Table[solns[n], {n, 100}] (* Second program: *) a[n_] := Module[{s = 0, b, c, d, g}, Do[g = Quotient[n^2, d]; If[d <= g && Mod[d+g, 2] == 0, c = Quotient[d+g, 2]; b = g-c; If[n < b && GCD[b, c] == 1, s++]], {d, Divisors[n^2]}]; s]; Array[a, 100] (* Jean-François Alcover, Apr 27 2019, from PARI *)
-
PARI
nppt(a) = { my(s=0, b, c, d, g); fordiv(a^2, d, g=a^2\d; if(d<=g && (d+g)%2==0, c=(d+g)\2; b=g-c; if(aColin Barker, Oct 25 2015
Comments