A047800 Number of different values of i^2 + j^2 for i,j in [0, n].
1, 3, 6, 10, 15, 20, 27, 34, 42, 51, 61, 71, 83, 94, 106, 120, 135, 148, 165, 180, 198, 216, 235, 252, 273, 294, 315, 337, 360, 382, 408, 431, 457, 484, 508, 536, 567, 595, 624, 653, 687, 715, 749, 781, 813, 850, 884, 919, 957, 993, 1031, 1069, 1108, 1142
Offset: 0
Links
- T. D. Noe and Vaclav Kotesovec, Table of n, a(n) for n = 0..10000 (terms 0..500 from T. D. Noe)
- Paul Erdős, On sets of distances of n points, American Mathematical Monthly 53, pp. 248-250 (1946).
- Vaclav Kotesovec, Graph - The asymptotic ratio
- Edmund Landau, Handbuch der Lehre von der Verteilung der Primzahlen, vol. 2, Leipzig B. G. Teubner, 1909, p. 643.
- Hugo Pfoertner, Plot of asymptotic ratio, 1.44*10^6 terms, logarithmic scale for n, indicating c > 0.8.
Programs
-
Haskell
import Data.List (nub) a047800 n = length $ nub [i^2 + j^2 | i <- [0..n], j <- [i..n]] -- Reinhard Zumkeller, Oct 03 2012
-
Mathematica
Table[ Length@Union[ Flatten[ Table[ i^2+j^2, {i, 0, n}, {j, 0, n} ] ] ], {n, 0, 49} ] nmax = 100; sq = Table[i^2 + j^2, {i, 0, nmax}, {j, 0, nmax}]; Table[Length@Union[Flatten[Table[Take[sq[[j]], n + 1], {j, 1, n + 1}]]], {n, 0, nmax}] (* Vaclav Kotesovec, Mar 09 2016 *)
-
PARI
a(n) = n++; #vecsort(vector(n^2, i, ((i-1)\n)^2+((i-1)%n)^2), , 8) \\ Charles R Greathouse IV, Jun 13 2013; edited by Michel Marcus, Jul 06 2025
-
PARI
a(n) = #setbinop((i,j)->i^2+j^2, [0..n]); \\ Michel Marcus, Jul 07 2025
-
Python
def A047800(n): return len(set(i**2+j**2 for i in range(n+1) for j in range(i+1))) # Chai Wah Wu, Jul 07 2025
Comments