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.

A053597 Let prime(i) = i-th prime (A000040), let d(i) = prime(i+1)-prime(i) (A001223); a(n) = number of distinct numbers among d(n), d(n+1), d(n+2), ... before first duplicate is encountered.

Original entry on oeis.org

2, 1, 2, 2, 2, 2, 3, 3, 2, 3, 3, 2, 3, 2, 1, 2, 3, 3, 3, 3, 2, 3, 4, 3, 2, 2, 2, 3, 2, 5, 4, 3, 2, 3, 2, 1, 2, 2, 1, 3, 2, 3, 2, 3, 2, 1, 3, 2, 3, 4, 3, 3, 2, 1, 1, 2, 3, 5, 4, 4, 4, 3, 2, 5, 5, 5, 4, 5, 4, 3, 2, 2, 1, 2, 3, 3, 2, 4, 3, 2, 2, 4, 3, 2, 3, 4, 3, 2, 4, 3, 3, 2, 2, 6, 5, 4, 5, 4, 3, 2, 2, 1, 2, 3, 2
Offset: 1

Views

Author

N. J. A. Sloane, Jan 07 2003

Keywords

Examples

			The d sequence starting at prime(7) = 17 is d(7) = 2, d(8) = 4, d(9) = 6, d(10) = 2, with three numbers before the first duplication, so a(7) = 3.
		

Crossrefs

A078515 gives RECORDS transform of this sequence. See also A079007.

Programs

  • Maple
    P:= [seq(ithprime(i),i=1..1000)]:
    G:= P[2..-1]-P[1..-2]:
    R:= Vector(990):
    for i from 1 to 990 do
      for k from 1 while nops(convert(G[i..i+k-1],set))=k do od:
      R[i]:= k-1;
    od:
    convert(R,list);
  • Mathematica
    f[n_] := Block[{k = 1}, While[p = Table[ Prime[i], {i, n, n + k}]; Length[ Union[ Drop[p, 1] - Drop[p, -1]]] == k, k++ ]; k - 1]; Table[ f[n], {n, 1, 105}]

Extensions

More terms from Robert G. Wilson v, Jan 07 2002