login
Number of Pythagorean triples with perimeter <= 10^n.
1

%I #60 Feb 16 2025 08:33:53

%S 0,17,325,4858,64741,808950,9706567,113236940,1294080089,14557915466

%N Number of Pythagorean triples with perimeter <= 10^n.

%H Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/PythagoreanTriple.html">Pythagorean Triple</a>

%H Wikipedia, <a href="https://en.wikipedia.org/wiki/Tree_of_primitive_Pythagorean_triples">Tree of primitive Pythagorean triples</a>

%e n = 2

%e perimeter | Pythagorean triple

%e -------------------------------

%e 12 | [ 3, 4, 5]

%e 30 | [ 5, 12, 13]

%e 24 | [ 6, 8, 10]

%e 56 | [ 7, 24, 25]

%e 40 | [ 8, 15, 17]

%e 36 | [ 9, 12, 15]

%e 90 | [ 9, 40, 41]

%e 60 | [10, 24, 26]

%e 48 | [12, 16, 20]

%e 84 | [12, 35, 37]

%e 60 | [15, 20, 25]

%e 90 | [15, 36, 39]

%e 80 | [16, 30, 34]

%e 72 | [18, 24, 30]

%e 70 | [20, 21, 29]

%e 84 | [21, 28, 35]

%e 96 | [24, 32, 40]

%o (Ruby)

%o def f(a, b, c, n)

%o return 0 if a + b + c > n

%o s = n / (a + b + c)

%o s += f( a - 2 * b + 2 * c, 2 * a - b + 2 * c, 2 * a - 2 * b + 3 * c, n)

%o s += f( a + 2 * b + 2 * c, 2 * a + b + 2 * c, 2 * a + 2 * b + 3 * c, n)

%o s += f(-a + 2 * b + 2 * c, -2 * a + b + 2 * c, -2 * a + 2 * b + 3 * c, n)

%o return s

%o end

%o def A299706(n)

%o (1..n).map{|i| f(3, 4, 5, 10 ** i)}

%o end

%o p A299706(8)

%Y Cf. A024155, A101929, A101930, A101931, A249750.

%K nonn,more,changed

%O 1,2

%A _Seiichi Manyama_, Feb 26 2018