A135044 a(1)=1, then a(c) = p and a(p) = c, where c = T_c(r,k) and p = T_p(r,k), and where T_p contains the primes arranged in rows by the prime index chain and T_c contains the composites arranged in rows by the order of compositeness. See Formula.
1, 4, 9, 2, 16, 7, 6, 13, 3, 19, 26, 17, 8, 23, 41, 5, 12, 67, 10, 29, 59, 37, 14, 83, 179, 11, 43, 331, 20, 47, 39, 109, 277, 157, 53, 431, 22, 1063, 31, 191, 15, 2221, 27, 61, 211, 71, 30, 599, 1787, 919, 241, 3001, 35, 73, 8527, 127, 1153, 79, 21, 19577, 44, 89, 283
Offset: 1
Keywords
Examples
From _Andrew Weimholt_, Jan 29 2014: (Start) More generally, takes the primes organized in an array according to the sieving process described in the Fernandez paper: Row[1](n) = 2, 7, 13, 19, 23, ... Row[2](n) = 3, 17, 41, 67, 83, ... Row[3](n) = 5, 59, 179, ... Row[4](n) = 11, 277, ... Lets call this T_p (n, k) Also take the composites organized in a similar manner, except we use "composite" numbered positions in our sieve: Row[1](n) = 4, 6, 8, 10, 14, 20, 22, ... Row[2](n) = 9, 12, 15, 18, 24, ... Row[3](n) = 16, 21, 25, ... Lets call this T_c (n, k) If we now take the natural numbers and swap each number (except for 1) with the number which holds the same spot in the other array, then we get the sequence: 1, 4, 9, 2, 16, 7, 6, 13, with for example a(8) = 13 (13 holds the same position in the 'prime' table as 8 does in the 'composite' table). (End)
Links
- R. J. Mathar, Table of n, a(n) for n = 1..197
- N. Fernandez, An order of primeness, F(p).
- N. Fernandez, An order of primeness [cached copy, included with permission of the author]
- Index to permutations of positive integers
Crossrefs
Programs
-
Maple
A135044 := proc(n) if n = 1 then 1; elif isprime(n) then idx := -1 ; for r from 1 do for c from 1 do if A236542(r,c) = n then idx := [r,c] ; end if; if A236542(r,c) >= n then break; end if; end do: if type(idx,list) then break; end if; end do: A236536(r,c) ; else idx := -1 ; for r from 1 do for c from 1 do if A236536(r,c) = n then idx := [r,c] ; end if; if A236536(r,c) >= n then break; end if; end do: if type(idx,list) then break; end if; end do: A236542(r,c) ; end if; end proc: # R. J. Mathar, Jan 28 2014
-
Mathematica
Composite[n_Integer] := Block[{k = n + PrimePi@n + 1}, While[k != n + PrimePi@k + 1, k++ ]; k]; Compositeness[n_] := Block[{c = 1, k = n}, While[ !(PrimeQ@k || k == 1), k = k - 1 - PrimePi@k; c++ ]; c]; Primeness[n_] := Block[{c = 1, k = n}, While[ PrimeQ@k, k = PrimePi@k; c++ ]; c]; ckj[k_, j_] := Select[ Table[Composite@n, {n, 10000}], Compositeness@# == j &][[k]]; pkj[k_, j_] := Select[ Table[Prime@n, {n, 3000}], Primeness@# == j &][[k]]; f[0]=0; f[1] = 1; f[n_] := If[ PrimeQ@ n, pn = Primeness@n; ckj[ Position[ Select[ Table[ Prime@ i, {i, 150}], Primeness@ # == pn &], n][[1, 1]], pn], cn = Compositeness@n; pkj[ Position[ Select[ Table[ Composite@ i, {i, 500}], Compositeness@ # == cn &], n][[1, 1]], cn]]; Array[f, 64] (* Robert G. Wilson v *)
Extensions
Edited, corrected and extended by Robert G. Wilson v, Feb 18 2008
Name corrected by Andrew Weimholt, Jan 29 2014
Comments