A008846 Hypotenuses of primitive Pythagorean triangles.
5, 13, 17, 25, 29, 37, 41, 53, 61, 65, 73, 85, 89, 97, 101, 109, 113, 125, 137, 145, 149, 157, 169, 173, 181, 185, 193, 197, 205, 221, 229, 233, 241, 257, 265, 269, 277, 281, 289, 293, 305, 313, 317, 325, 337, 349, 353, 365, 373, 377, 389, 397, 401, 409, 421, 425, 433
Offset: 1
References
- A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, pp. 10, 107.
Links
- Zak Seidov, Table of n, a(n) for n = 1..87881 (with a(n) up to 10^6).
- Ron Knott, Pythagorean Triples and Online Calculators
Crossrefs
Programs
-
Haskell
a008846 n = a008846_list !! (n-1) a008846_list = filter f [1..] where f n = all ((== 1) . (`mod` 4)) $ filter ((== 0) . (n `mod`)) [1..n] -- Reinhard Zumkeller, Apr 27 2011
-
Maple
for x from 1 by 2 to 50 do for y from 2 by 2 to 50 do if gcd(x,y) = 1 then print(x^2+y^2); fi; od; od; [ then sort ].
-
Mathematica
Union[ Map[ Plus@@(#1^2)&, Select[ Flatten[ Array[ {2*#1, 2*#2-1}&, {10, 10} ], 1 ], GCD@@#1 == 1& ] ] ] (* Olivier Gérard, Aug 15 1997 *) lst = {}; Do[ If[ GCD[m, n] == 1, a = 2 m*n; b = m^2 - n^2; c = m^2 + n^2; AppendTo[lst, c]], {m, 100}, {n, If[ OddQ@m, 2, 1], m - 1, 2}]; Take[ Union@ lst, 57] (* Robert G. Wilson v, May 02 2009 *) Union[Sqrt[#[[1]]^2+#[[2]]^2]&/@Union[Sort/@({Times@@#,(Last[#]^2-First[#]^2)/2}&/@ (Select[Subsets[Range[1,33,2],{2}],GCD@@#==1&]))]] (* Harvey P. Dale, Aug 26 2012 *)
-
PARI
is(n)=Set(factor(n)[,1]%4)==[1] \\ Charles R Greathouse IV, Nov 06 2015
-
Python
# for an array from the beginning from math import gcd, isqrt hypothenuses_upto = 433 A008846 = set() for x in range(2, isqrt(hypothenuses_upto)+1): for y in range(min(x-1, (yy:=isqrt(hypothenuses_upto-x**2))-(yy%2 == x%2)) , 0, -2): if gcd(x,y) == 1: A008846.add(x**2 + y**2) print(A008846:=sorted(A008846)) # Karl-Heinz Hofmann, Sep 30 2024
-
Python
# for single k from sympy import factorint def A008846_isok(k): return not any([(pf-1) % 4 for pf in factorint(k)]) # Karl-Heinz Hofmann, Oct 01 2024
Formula
x^2 + y^2 where x is even, y is odd and gcd(x, y)=1. Essentially the same as A004613.
Extensions
More terms from T. D. Noe, Sep 30 2002
Comments