OFFSET
0,2
COMMENTS
Consider a 2D lattice, where the Cartesian coordinates x and y are legs of the Pythagorean triangle. Thus the notion of Pythagorean triple is extended to the cases when sides x, y are in Z (i.e., sides also include negative integers and zero). The sequence gives the number of such triples on or inside a circle of radius n.
Partial sums of A046109.
LINKS
Alexander Kritov, Source code
EXAMPLE
Sides (coordinates) a(n)
------------------------------------------------------------------------------
(0,0) 1
(-1,0)(0,-1)(0,1)(1,0) 5
(-2,0)(0,-2)(0,2)(2,0) 9
(-3,0)(0,-3)(0,3)(3,0) 13
(-4,0)(0,-4)(0,4)(4,0) 17
(-5,0)(-4,-3)(-4,3)(-3,-4)(-3,4)(0,-5)(0,5)(3,-4)(3,4)(4,-3)(4,3)(5,0) 29
(-6,0)(0,-6)(0,6)(6,0) 33
(-7,0)(0,-7)(0,7)(7,0) 37
(-8,0)(0,-8)(0,8)(8,0) 41
(-9,0)(0,-9)(0,9)(9,0) 45
(-10,0)(-8,-6)(-8,6)(-6,-8)(-6,8)(0,-10)(0,10)(6,-8)(6,8)(8,-6)(8,6)(10,0) 57
(-11,0)(0,-11)(0,11)(11,0) 61
(-12,0)(0,-12)(0,12)(12,0) 65
PROG
(C) See links.
(PARI) f(n) = if(n==0, return(1)); my(f=factor(n)); 4*prod(i=1, #f~, if(f[i, 1]%4==1, 2*f[i, 2]+1, 1)); \\ A046109
a(n) = sum(k=0, n, f(k)); \\ Michel Marcus, Nov 27 2021
CROSSREFS
KEYWORD
nonn
AUTHOR
Alexander Kritov, Nov 21 2021
STATUS
approved