OFFSET
1,1
COMMENTS
a(n) is also the smallest short leg of a Pythagorean triangle where the difference between the two legs is n.
LINKS
Felix Huber, Table of n, a(n) for n = 1..10000
Eric Weisstein's World of Mathematics, Pythagorean Triple
FORMULA
a(n) = (A289398(n) - n)/2.
EXAMPLE
a(1) = 3 because 3^2 + (3 + 1)^2 = 5^2 and there is no smaller positive integer k than 3 with that property.
a(28) = 20 because 20^2 + (20 + 28)^2 = 52^2 and there is no smaller positive integer k than 20 with that property.
MAPLE
MATHEMATICA
s={}; Do[k=0; Until[IntegerQ[Sqrt[k^2+(k+n)^2]], k++]; AppendTo[s, k], {n, 63}]; s (* James C. McMahon, Mar 02 2025 *)
PROG
(PARI) a(n) = my(k=1); while (!issquare(k^2 + (k + n)^2), k++); k; \\ Michel Marcus, Feb 15 2025
(Python)
from itertools import count
from sympy.ntheory.primetest import is_square
def A379596(n): return next(k for k in count(1) if is_square(k**2+(k+n)**2)) # Chai Wah Wu, Mar 02 2025
CROSSREFS
KEYWORD
nonn,easy,new
AUTHOR
Felix Huber, Feb 15 2025
STATUS
approved