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.
%I A336364 #17 Jun 20 2025 08:12:24 %S A336364 2,3,1,5,4,9,7,6,15,26,11,8,21,34,93,13,10,25,50,117,118,17,12,27,56, %T A336364 123,122,119,19,14,33,64,143,144,121,120,23,16,35,76,145,186,205,300, %U A336364 531,29,18,39,86,185,204,217,324,533,532,31,20,45,92,187,206 %N A336364 Rectangular array by antidiagonals: row n shows the positive integers whose distance to the nearest prime is n. %C A336364 Row 1: the primes, A000040. Every positive integer occurs exactly once, so that as a sequence, this is a permutation of the positive integers. %H A336364 Sean A. Irvine, <a href="https://github.com/archmageirvine/joeis/blob/master/src/irvine/oeis/a336/A336364.java">Java program</a> (github). %H A336364 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a> %e A336364 Corner: %e A336364 2 3 5 7 11 13 17 19 23 29 31 37 %e A336364 1 4 6 8 10 12 14 16 18 20 22 24 %e A336364 9 15 21 25 27 33 35 39 45 49 51 55 %e A336364 26 34 50 56 64 76 86 92 94 116 124 134 %e A336364 93 117 123 143 145 185 187 203 207 215 219 245 %t A336364 a[_?PrimeQ] = 0; a[n_] := Min[NextPrime[n] - n, n - NextPrime[n, -1]]; %t A336364 t = Table[a[n], {n, 1, 2000}]; (* A051699 *) %t A336364 r[n_] := Flatten[Position[t, n]]; u[n_, k_] := r[n][[k]]; %t A336364 TableForm[Table[u[n, k], {n, 0, 15}, {k, 1, Length[r[n]]}]] (* A337364, array *) %t A336364 Table[u[n - k, k], {n, 0, 15}, {k, n, 1, -1}] // Flatten (* A337364, sequence *) %Y A336364 Cf. A000040, A051699, A336365. %K A336364 nonn,tabl %O A336364 1,1 %A A336364 _Clark Kimberling_, Jul 19 2020