

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.


5



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
(list;
graph;
refs;
listen;
history;
text;
internal format)



OFFSET

1,2


COMMENTS

Exchanges primes with composites, primeth primes with composith composites, etc.
Exchange the kth prime of order j with the kth composite of order j and vice versa.
Selfinverse permutation of positive integers.
If n is the composite number A236536(r,k), then a(n) is the corresponding prime A236542(r,k) at the same position (r,k). Vice versa, if n is the prime A236542(r,k), then a(n) is the corresponding composite A236536(r,k) at the same position.  Andrew Weimholt, Jan 28 2014
The original name for this entry did not produce this sequence, but instead A236854, which differs from this permutation for the first time at n=8, where A236854(8)=23, while here a(8)=13.  Antti Karttunen, Feb 01 2014


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


FORMULA

a(1)=1, a(A236536(r,k))=A236542(r,k), a(A236542(r,k))=A236536(r,k)


EXAMPLE

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)


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 *)


CROSSREFS

Cf. A000040, A007097, A049076, A049078  A049081, A058322, A058324  A058328, A093046, A002808, A006508, A059981, A078442, A236854.
Sequence in context: A128204 A079049 A114578 * A236854 A235491 A256513
Adjacent sequences: A135041 A135042 A135043 * A135045 A135046 A135047


KEYWORD

nonn


AUTHOR

Katarzyna Matylla, Feb 11 2008


EXTENSIONS

Edited, corrected and extended by Robert G. Wilson v, Feb 18 2008
Name corrected by Andrew Weimholt, Jan 29 2014


STATUS

approved



