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.

A192177 Array determined by distance down to nearest prime.

This page as a plain text file.
%I A192177 #9 Feb 13 2014 13:18:20
%S A192177 1,2,5,3,7,10,4,9,16,11,6,13,22,17,28,8,15,26,23,36,29,12,19,34,27,52,
%T A192177 37,96,14,21,40,35,58,53,120,97,18,25,46,41,66,59,146,121,122,20,31,
%U A192177 50,47,78,67,188,147,148,123,24,33,56,51,88,79,206,189,190,149,11
%N A192177 Array determined by distance down to nearest prime.
%C A192177 Row 1:  numbers k such that k = 1 or k = 2 or k - 1 is a prime.
%C A192177 Row r > 1: numbers k such that k - r is a prime and k - q is not, for q = 1, 2, ..., r - 1.
%C A192177 Every positive integer occurs exactly once, so that as a sequence, A192177 is a permutation of the positive integers.
%C A192177 For r>1, the numbers in row r have the parity of r-1; e.g., the numbers in row 2 are odd.
%e A192177 Northwest corner:
%e A192177 1....2....3....4....6....8
%e A192177 5....7....9....13...15...19
%e A192177 10...16...22...26...34...40
%e A192177 11...17...23...27...35...41
%e A192177 28...36...52...58...66...78
%e A192177 ...
%e A192177 For example, 16 is in row 3 because 16 - 3 is prime, unlike 16 - 1 and 16 - 2.
%t A192177 z = 5000; (* z = number of primes used *)
%t A192177 row[1] = (#1[[1]] &) /@ Cases[Array[{#1, PrimeQ[#1 - 1] || #1 == 1 || #1 == 2} &, {z}], {_, True}];
%t A192177 Do[row[x] = Complement[(#1[[1]] &) /@  Cases[Array[{#1, PrimeQ[#1 - x]} &, {z}], {_, True}], Flatten[Array[row, {x - 1}]]], {x, 2, 10}];
%t A192177 TableForm[Array[row, {10}]]  (* A192177 array *)
%t A192177 Flatten[Table[row[k][[n - k + 1]], {n, 1, 11}, {k, 1,
%t A192177    n}]]  (* A192177 sequence *)
%t A192177 (* by _Peter J. C. Moses_, Jun 24 2011 *)
%Y A192177 Cf. A192175, A192176, A192178, A192179.
%K A192177 nonn,tabl
%O A192177 1,2
%A A192177 _Clark Kimberling_, Jun 24 2011