login
A278761
a(n) is the number of parallelepipeds with vertices with integer coordinates between 0 and n and diagonals from one corner to the opposite corner with an integer length.
0
0, 0, 1, 1, 1, 1, 2, 4, 5, 6, 6, 7, 10, 10, 11, 12, 15, 16, 19, 20, 23, 25, 28, 30, 33, 35, 38, 40, 44, 47, 52, 54, 57, 59, 63, 65, 71, 73, 79, 81, 86, 89, 98, 101, 106, 108, 114, 117, 126, 130, 137, 142, 147, 150, 159, 162, 173, 178, 182
OFFSET
0,7
FORMULA
Sides a,b,c must satisfy the conditions that (1) a^2 + b^2 + c^2 = d^2 and (2) a, b, and c are positive, coprime, and not > n.
EXAMPLE
n=8: [1,2,2],[1,4,8],[2,3,6],[4,4,7],[6,6,7].
PROG
(Python)
def coprime(k, m, n):
while m:
k, m=m, k%m
if k==1:return 1
while k:
n, k=k, n%k
return n
def a(n):
kv=set(i**2 for i in range(2*n))
pyt=0
for a in range(1, n):
for b in range(a, n+1):
for c in range(b, n+1):
if a**2+b**2+c**2 in kv and coprime(a, b, c)==1:
pyt+=1
return pyt
print([a(n) for n in range(70)])
CROSSREFS
Sequence in context: A086370 A083788 A058317 * A287076 A344587 A100006
KEYWORD
nonn
AUTHOR
Knut Ångström, Nov 27 2016
EXTENSIONS
Formula clarified by Harvey P. Dale, Dec 08 2017
STATUS
approved