A024363 Number of primitive Pythagorean triangles with side n.
0, 0, 1, 1, 2, 0, 1, 1, 1, 0, 1, 2, 2, 0, 2, 1, 2, 0, 1, 2, 2, 0, 1, 2, 2, 0, 1, 2, 2, 0, 1, 1, 2, 0, 2, 2, 2, 0, 2, 2, 2, 0, 1, 2, 2, 0, 1, 2, 1, 0, 2, 2, 2, 0, 2, 2, 2, 0, 1, 4, 2, 0, 2, 1, 4, 0, 1, 2, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 1, 2, 1, 0, 1, 4, 4, 0, 2, 2, 2, 0, 2, 2, 2, 0, 2, 2, 2, 0, 2
Offset: 1
Keywords
Links
- Frank M Jackson, Table of n, a(n) for n = 1..10000
- Ron Knott, Pythagorean Triples and Online Calculators
Programs
-
Mathematica
lst={}; xmax=51; Do[If[GCD[x, y]==1&&OddQ[x+y], AppendTo[lst, Sort@{x^2-y^2, 2 x*y, x^2+y^2}]], {x, xmax}, {y, x}]; BinCounts[Select[Flatten@lst, #<2xmax &], {1, 2(xmax-1), 1}] (* or *) a[n_] := Block[{x, y, s = List@ ToRules@ Reduce[(x^2-y^2 == n^2 || x^2 + y^2 == n^2) && x>y>0, {x, y}, Integers]}, If[s == {}, 0, Length@ Select[ {x, y} /. s, GCD @@ # == 1 &]]]; Array[a, 99] (* Giovanni Resta, Jun 19 2017 *)
Comments