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.

A072926 a(n) = Sum_{k=1..n} A051699(k).

Original entry on oeis.org

1, 1, 1, 2, 2, 3, 3, 4, 6, 7, 7, 8, 8, 9, 11, 12, 12, 13, 13, 14, 16, 17, 17, 18, 20, 23, 25, 26, 26, 27, 27, 28, 30, 33, 35, 36, 36, 37, 39, 40, 40, 41, 41, 42, 44, 45, 45, 46, 48, 51, 53, 54, 54, 55, 57, 60, 62, 63, 63, 64, 64, 65, 67, 70, 72, 73, 73, 74, 76, 77, 77, 78, 78, 79
Offset: 1

Views

Author

Benoit Cloitre, Aug 11 2002

Keywords

Crossrefs

Cf. A051699.

Programs

  • Mathematica
    f[n_] := If[PrimeQ[n], 0, Min[NextPrime[n] - n, n - NextPrime[n, -1]]]; Accumulate[Table[f[n], {n, 1, 100}]] (* Amiram Eldar, May 05 2022 *)
  • PARI
    a(n)=sum(k=1,n,vecmin(vector(k,i,abs(k-prime(i)))))
    
  • Python
    from sympy import nextprime; p = a = 1
    while p < 71:
        q = nextprime(p); h = (q - p)//2
        for i in range(q-p): a += h - abs(h-i); print(a, end = ', ')
        p = q # Ya-Ping Lu, Apr 06 2025

Formula

Conjecture: a(n) is asymptotic to C*n*log(n) with C = 0.29... .
From Ya-Ping Lu, Apr 06 2025: (Start)
C = lim_{n->oo} a(n)/(n*log(n)) = 0.44 approximately.
a(prime(m)) = 1 + Sum_(i=3..m) (1/4)*(prime(i)-prime(i-1))^2. (End)