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.

A320687 Sum of differences of the larger square and primes between two squares.

Original entry on oeis.org

3, 6, 8, 16, 12, 28, 19, 34, 31, 72, 42, 58, 63, 70, 116, 122, 79, 90, 112, 134, 169, 170, 108, 212, 200, 196, 246, 226, 240, 244, 292, 318, 394, 276, 336, 418, 283, 528, 445, 582, 429, 392, 530, 416, 565, 506, 581, 634, 548, 554, 655, 866, 616, 676, 641, 714, 965, 710, 922, 968, 827
Offset: 1

Views

Author

M. F. Hasler, Oct 19 2018

Keywords

Comments

Consider the primes p1,...,pK between two squares n^2 and (n+1)^2, and take the sum of the differences (listed as A106044): ((n+1)^2 - p1) + ... + ((n+1)^2 - pK).

Examples

			a(1) = 3 = 2 + 1, where {2, 1} = 4 - {2, 3: primes between 1^2 = 1 and 2^2 = 4}.
a(2) = 6 = 4 + 2, with {4, 2} = 9 - {5, 7: primes between 2^2 = 4 and 3^2 = 9}.
a(3) = 8 = sum of {5, 3} = 16 - {11, 13: primes between 3^2 = 9 and 4^2 = 16}.
a(4) = 16 = sum of {8, 6, 2} = 25 - {17, 19, 23: primes between 4^2 and 5^2 = 25}.
a(5) = 12 = sum of {7, 5} = 36 - {29, 31: primes between 5^2 = 25 and 6^2 = 36}.
		

Crossrefs

Equals A014085 * A000290(.+1) - A108314.
Row sums of A106044 read as a table.

Programs

  • Maple
    N:= 100: # to get a(1)..a(N)
    V:= Vector(N):
    p:= 1;
    do
       p:= nextprime(p);
       n:= floor(sqrt(p));
       if n > N then break fi;
       V[n]:= V[n]+(n+1)^2-p;
    od:
    convert(V,list); # Robert Israel, Jun 17 2019
  • PARI
    a(n,s=0)={forprime(p=n^2,(n+=1)^2,s+=n^2-p);s}

Formula

a(n) = A014085(n)*A000290(n+1) - A108314(n), where A000290(n) = n^2.