|
|
A374020
|
|
Number of solutions to a^2 + d^2 = b^2 + c^2 with 1 <= a < b < c < d <= n.
|
|
0
|
|
|
0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 4, 5, 7, 9, 10, 12, 15, 18, 23, 26, 29, 33, 39, 43, 48, 54, 60, 65, 74, 79, 87, 96, 105, 114, 122, 129, 140, 151, 162, 171, 185, 194, 210, 223, 233, 247, 264, 277, 293, 308, 323, 338, 360, 376, 392, 407, 425, 444, 468, 484
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,9
|
|
LINKS
|
|
|
EXAMPLE
|
For n = 9 the a(9) = 2 solutions are 1^2 + 8^2 = 4^2 + 7^2 = 65 and 2^2 + 9^2 = 6^2 + 7^2 = 85.
For n = 18 three of the a(18) = 18 solutions sum up to 325: 1^2 + 18^2 = 6^2 + 17^2 = 10^2 + 15^2.
|
|
PROG
|
(C) #include <stdio.h>
#define N 10000ULL
typedef unsigned long long ull_t;
ull_t Sums[2 * N * N];
int main() {
ull_t sol = 0;
for (ull_t i = 1; i < N; i++)
for (ull_t j = i + 1; j <= N; j++)
sol += Sums[i * i + j * j]++;
printf("%llu \n", sol);
}
(Python)
from itertools import count, islice
from collections import Counter
def A374020_gen(): # generator of terms
c, s = 0, Counter()
for n in count(1):
n2 = n**2
for i in range(1, n):
c += s[m:=i**2+n2]
s[m] += 1
yield c
|
|
CROSSREFS
|
|
|
KEYWORD
|
nonn
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|