cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A374020 Number of solutions to a^2 + d^2 = b^2 + c^2 with 1 <= a < b < c < d <= n.

This page as a plain text file.
%I A374020 #37 May 15 2025 08:17:01
%S A374020 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,
%T A374020 65,74,79,87,96,105,114,122,129,140,151,162,171,185,194,210,223,233,
%U A374020 247,264,277,293,308,323,338,360,376,392,407,425,444,468,484
%N A374020 Number of solutions to a^2 + d^2 = b^2 + c^2 with 1 <= a < b < c < d <= n.
%H A374020 Seiichi Manyama, <a href="/A374020/b374020.txt">Table of n, a(n) for n = 1..1000</a>
%H A374020 Quora, <a href="https://www.quora.com/Can-the-sum-of-two-squares-a-2-b-2-be-equal-to-the-sum-of-two-other-squares-c-2-d-2-where-a-b-c-d-are-distinct-positive-integers-If-so-how-do-we-calculate-them">Can the sum of two squares a^2+b^2 be equal to the sum of two other squares c^2+d^2 where a,b,c,d are distinct positive integers? If so, how do we calculate them?</a>
%e A374020 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.
%e A374020 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.
%o A374020 (C) #include <stdio.h>
%o A374020 #define N    10000ULL
%o A374020 typedef unsigned long long ull_t;
%o A374020 ull_t Sums[2 * N * N];
%o A374020 int main() {
%o A374020     ull_t sol = 0;
%o A374020     for (ull_t i = 1; i < N; i++)
%o A374020         for (ull_t j = i + 1; j <= N; j++)
%o A374020             sol += Sums[i * i + j * j]++;
%o A374020     printf("%llu \n", sol);
%o A374020 }
%o A374020 (Python)
%o A374020 from itertools import count, islice
%o A374020 from collections import Counter
%o A374020 def A374020_gen(): # generator of terms
%o A374020     c, s = 0, Counter()
%o A374020     for n in count(1):
%o A374020         n2 = n**2
%o A374020         for i in range(1,n):
%o A374020             c += s[m:=i**2+n2]
%o A374020             s[m] += 1
%o A374020         yield c
%o A374020 A374020_list = list(islice(A374020_gen(),20)) # _Chai Wah Wu_, Jul 18 2024
%K A374020 nonn
%O A374020 1,9
%A A374020 _Thorsten Ehlers_, Jun 25 2024