This site is supported by donations to The OEIS Foundation.

 Hints (Greetings from The On-Line Encyclopedia of Integer Sequences!)
 A026234 In the sequence of positive integers, swap the k-th prime and k-th nonprime, for k = 1,2,3,... 7

%I

%S 2,1,4,3,6,5,8,7,11,13,9,17,10,19,23,29,12,31,14,37,41,43,15,47,53,59,

%T 61,67,16,71,18,73,79,83,89,97,20,101,103,107,21,109,22,113,127,131,

%U 24,137,139,149,151,157,25,163,167,173,179,181

%N In the sequence of positive integers, swap the k-th prime and k-th nonprime, for k = 1,2,3,...

%C A permutation of the positive integers. - _M. F. Hasler_, Jan 29 2014

%H Zak Seidov, <a href="/A026234/b026234.txt">Table of n, a(n) for n = 1..1000.</a>

%F If n is prime, then a(n) = A018252(n), else a(n) = A000040(n). - _M. F. Hasler_, Jan 29 2014

%e a(1) = 2 because 1 is not prime and the first prime is 2.

%e a(2) = 1 because 2 is prime and the first nonprime is 1.

%e a(3) = 4 because 3 is prime and the second nonprime is 4.

%e a(4) = 3 because 4 is not prime and the second prime is 3.

%e a(5) = 6 because 5 is prime and the third nonprime is 6.

%t nonPrimePi[n_] := n - PrimePi[n]; nonPrime[n_] := FixedPoint[n + PrimePi[#] &, n + PrimePi[n]]; A026234[n_] := If[PrimeQ[n], nonPrime[PrimePi[n]], Prime[nonPrimePi[n]]]; Table[A026234[n], {n, 200}] (* _Enrique PĂ©rez Herrero_, Jan 28 2014 *)

%o (PARI) c=p=0;vector(99,n,if(isprime(n),while(isprime(c++),);c,prime(p++))) \\ _M. F. Hasler_, Jan 29 2014

%o (PARI) A026234 = n->if(isprime(n),A018252(primepi(n)),prime(n-primepi(n))) \\ _M. F. Hasler_, Jan 29 2014

%Y Cf. A236675, A236676.

%K nonn,easy

%O 1,1

%A _Clark Kimberling_

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

Last modified April 18 12:42 EDT 2019. Contains 322209 sequences. (Running on oeis4.)