OFFSET
0,2
COMMENTS
a(n-1) is the number of distinct distances on an n X n pegboard. What is its asymptotic growth? Can it be efficiently computed for large n? - Charles R Greathouse IV, Jun 13 2013
Conjecture (after Landau and Erdős): a(n) ~ c * n^2 / sqrt(log(n)), where c = 0.79... . - Vaclav Kotesovec, Mar 10 2016
LINKS
T. D. Noe and Vaclav Kotesovec, Table of n, a(n) for n = 0..10000 (terms 0..500 from T. D. Noe)
Erdős, P., 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.
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 *)
PROG
(Haskell)
import Data.List (nub)
a047800 n = length $ nub [i^2 + j^2 | i <- [0..n], j <- [i..n]]
-- Reinhard Zumkeller, Oct 03 2012
(PARI) a(n)=#vecsort(vector(n^2, i, ((i-1)\n)^2+((i-1)%n)^2), , 8) \\ Charles R Greathouse IV, Jun 13 2013
CROSSREFS
KEYWORD
nonn,easy,nice
AUTHOR
STATUS
approved