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.

A192178 Array by distance to nearest prime, by antidiagonals.

This page as a plain text file.
%I A192178 #7 Feb 13 2014 13:17:45
%S A192178 1,2,5,3,7,26,4,9,34,23,6,11,50,37,118,8,13,56,47,122,53,10,15,64,67,
%T A192178 144,89,120,12,17,76,79,186,119,300,409,14,19,86,83,204,121,324,479,
%U A192178 532,16,21,92,93,206,157,530,531,896,293,18,25,94,97,216,173,534,533,898,631,11
%N A192178 Array by distance to nearest prime, by antidiagonals.
%C A192178 Row 1:  numbers k such that k = 1 or k = 2 or (k - 1 or k + 1) is a prime.
%C A192178 Row r > 1: numbers k such that k + r or k - r is a prime but k + q and k - q are not, for q = 1, 2, ..., r - 1.
%C A192178 Every positive integer occurs exactly once, so that as a sequence, A192178 is a permutation of the positive integers.
%C A192178 For r > 1, the numbers in row r have the parity of r - 1; e.g., the numbers in row 2 are odd.
%e A192178 Northwest corner:
%e A192178 1....2....3....4....6....8....10
%e A192178 5....7....9....11...13...15...17
%e A192178 26...34...50...56...64...76...86
%e A192178 23...37...47...67...79...83...93
%e A192178 118..122..144..186..204..206..216
%e A192178 ...
%e A192178 For example, 34 is in row 3 recause its distance to the nearest prime is 3.
%t A192178 z = 5000; (* z = number of primes used *)
%t A192178 row[1] = (#1[[1]] &) /@ Cases[Array[{#1, PrimeQ[#1 - 1] || PrimeQ[#1 + 1] || #1 == 1 || #1 == 2} &, {z}], {_, True}];
%t A192178 Do[row[x] = Complement[(#1[[1]] &) /@ Cases[Array[{#1, PrimeQ[#1 - x] || PrimeQ[#1 + x]} &, {z}], {_, True}], Flatten[Array[row, {x - 1}]]], {x, 2, 10}];
%t A192178 TableForm[Array[row, {10}]]  (* A192178 array *)
%t A192178 Flatten[Table[row[k][[n - k + 1]], {n, 1, 11}, {k, 1,
%t A192178    n}]]   (* A192178 sequence *)
%t A192178 (* by _Peter J. C. Moses_, Jun 24 2011 *)
%Y A192178 Cf. A192175, A192176, A192177, A192179.
%K A192178 nonn,tabl
%O A192178 1,2
%A A192178 _Clark Kimberling_, Jun 24 2011