OFFSET
1,5
COMMENTS
Consider primitive Pythagorean triangles (A^2 + B^2 = C^2, (A, B) = 1, A <= B); sequence gives number of times AUBUC takes value n.
Using Euclidean parameters (x, y) with x > y to generate primitive Pythagorean triples to capture all occurrences of side n, the Mma program below must allow the x parameter to iterate at least (n+1)/2 times. - Frank M Jackson, Jun 12 2017
All terms are either 0 or powers of 2 (A000079), and record values occur at a(1) = 0, a(3) = 1, a(5) = 2, and then a(A002110(k+1)*2) = 2^k = A000079(k) for all k >= 2. - Charles L. Hohn, Jul 08 2026
LINKS
Frank M Jackson, Table of n, a(n) for n = 1..10000
Ron Knott, Pythagorean Triples and Online Calculators
FORMULA
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}] (* Frank M Jackson, Jun 12 2017 *)
(* Alternative: *)
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 *)
PROG
(PARI) a(n)={if(n<2 || n%4==2, return(0)); my(v=Vec(factor(n))[1]); 2^(#v-if(vecmax(v%4)==1, 0, 1))} \\ Charles L. Hohn, Jun 21 2026
CROSSREFS
KEYWORD
nonn,easy,changed
AUTHOR
STATUS
approved
