The OEIS mourns the passing of Jim Simons and is grateful to the Simons Foundation for its support of research in many branches of science, including the OEIS.
login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A253047 Start with the natural numbers 1,2,3,...; interchange 2*prime(i) and 3*prime(i+1) for each i, and interchange prime(prime(i)) with prime(2*prime(i)) for each i. 2

%I #27 Jul 27 2020 11:23:18

%S 1,2,7,9,13,15,3,8,4,21,29,12,5,33,6,16,43,18,19,20,10,39,23,24,25,51,

%T 27,28,11,30,79,32,14,57,35,36,37,69,22,40,101,42,17,44,45,87,47,48,

%U 49,50,26,52,53,54,55,56,34,93,139,60,61,111,63

%N Start with the natural numbers 1,2,3,...; interchange 2*prime(i) and 3*prime(i+1) for each i, and interchange prime(prime(i)) with prime(2*prime(i)) for each i.

%C This is an involution on the natural numbers: applying it twice gives the identity permutation.

%H Chai Wah Wu, <a href="/A253047/b253047.txt">Table of n, a(n) for n = 1..10000</a>

%H A. B. Frizell, <a href="http://dx.doi.org/10.1090/S0002-9904-1915-02686-8">Certain non-enumerable sets of infinite permutations</a>. Bull. Amer. Math. Soc. 21 (1915), no. 10, 495-499.

%H <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>

%p f:= proc(t)

%p local r;

%p if t mod 2 = 0 and isprime(t/2) then 3*nextprime(t/2)

%p elif t mod 3 = 0 and isprime(t/3) then 2*prevprime(t/3)

%p elif isprime(t) then

%p r:= numtheory:-pi(t);

%p if isprime(r) then ithprime(2*r)

%p elif r mod 2 = 0 and isprime(r/2) then ithprime(r/2)

%p else t

%p fi

%p else t

%p fi

%p end proc:

%p seq(f(i),i=1..100); # _Robert Israel_, Dec 26 2014

%t f[t_] := Module[{r}, Which[EvenQ[t] && PrimeQ[t/2], 3 NextPrime[t/2], Divisible[t, 3] && PrimeQ[t/3], 2 NextPrime[t/3, -1], PrimeQ[t], r = PrimePi[t]; Which[PrimeQ[r], Prime[2r], EvenQ[r] && PrimeQ[r/2], Prime[r/2], True, t], True, t]];

%t Array[f, 100] (* _Jean-François Alcover_, Jul 27 2020, after _Robert Israel_ *)

%o (Python)

%o from sympy import isprime, primepi, prevprime, nextprime, prime

%o def A253047(n):

%o ....if n <= 2:

%o ........return n

%o ....if n == 3:

%o ........return 7

%o ....q2, r2 = divmod(n,2)

%o ....if r2:

%o ........q3, r3 = divmod(n,3)

%o ........if r3:

%o ............if isprime(n):

%o ................m = primepi(n)

%o ................if isprime(m):

%o ....................return prime(2*m)

%o ................x, y = divmod(m,2)

%o ................if not y:

%o ....................if isprime(x):

%o ........................return prime(x)

%o ............return n

%o ........if isprime(q3):

%o ............return 2*prevprime(q3)

%o ........return n

%o ....if isprime(q2):

%o ........return 3*nextprime(q2)

%o ....return n # _Chai Wah Wu_, Dec 27 2014

%Y Cf. A064614, A253046, A253046.

%K nonn

%O 1,2

%A _N. J. A. Sloane_, Dec 26 2014

%E Definition supplied by _Robert Israel_, Dec 26 2014

%E Offset changed to 1 by _Chai Wah Wu_, Dec 27 2014

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified May 16 13:17 EDT 2024. Contains 372552 sequences. (Running on oeis4.)