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.

Showing 1-1 of 1 results.

A336365 Rectangular array by antidiagonals: row n shows the nonnegative integers whose distance to the nearest prime is n.

Original entry on oeis.org

2, 3, 1, 5, 4, 0, 7, 6, 9, 26, 11, 8, 15, 34, 93, 13, 10, 21, 50, 117, 118, 17, 12, 25, 56, 123, 122, 119, 19, 14, 27, 64, 143, 144, 121, 120, 23, 16, 33, 76, 145, 186, 205, 300, 531, 29, 18, 35, 86, 185, 204, 217, 324, 533, 532, 31, 20, 39, 92, 187, 206
Offset: 1

Views

Author

Clark Kimberling, Jul 19 2020

Keywords

Comments

Row 1: the primes, A000040.
Every nonnegative integer occurs exactly once, so that as a sequence, this is a permutation of the nonnegative integers.

Examples

			 Corner:
   2    3    5    7   11   13   17   19   23   29   31   37
   1    4    6    8   10   12   14   16   18   20   22   24
   0    9   15   21   24   27   33   35   39   45   49   51
  26   34   50   56   64   76   86   92   94  116  124  134
  93  117  123  143  145  185  187  203  207  215  219  245
		

Crossrefs

Programs

  • Mathematica
    a[?PrimeQ] = 0; a[n] := Min[NextPrime[n] - n, n - NextPrime[n, -1]];
    t = Table[a[n], {n, 0, 2000}]; (*  A051699 *)
    r[n_] := -1 + Flatten[Position[t, n]]; u[n_, k_] := r[n][[k]];
    TableForm[Table[u[n, k], {n, 0, 15}, {k, 1, Length[r[n]]}]] (* A336365, array *)
    Table[u[n - k, k], {n, 0, 15}, {k, n, 1, -1}] // Flatten  (* A336365, sequence *)
Showing 1-1 of 1 results.