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.

A253046 An involution of the natural numbers: if n = 2*p_i then replace n with 3*p_{i+1}, and conversely if n = 3*p_i then replace n with 2*p_{i-1}, where p_i denotes the i-th prime.

This page as a plain text file.
%I A253046 #28 May 22 2025 10:21:41
%S A253046 1,2,3,9,5,15,7,8,4,21,11,12,13,33,6,16,17,18,19,20,10,39,23,24,25,51,
%T A253046 27,28,29,30,31,32,14,57,35,36,37,69,22,40,41,42,43,44,45,87,47,48,49,
%U A253046 50,26,52,53,54,55,56,34,93,59,60,61,111,63,64,65,66,67
%N A253046 An involution of the natural numbers: if n = 2*p_i then replace n with 3*p_{i+1}, and conversely if n = 3*p_i then replace n with 2*p_{i-1}, where p_i denotes the i-th prime.
%C A253046 a(m) != m iff m is a term of A253106, i.e., a semiprime divisible by 2 or 3; a(A100484(n)) > A100484(n); a(A001748(n)) < A001748(n). - _Reinhard Zumkeller_, Dec 26 2014
%H A253046 Reinhard Zumkeller, <a href="/A253046/b253046.txt">Table of n, a(n) for n = 1..10000</a>
%H A253046 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 A253046 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%t A253046 a253046[n_] := Block[{f},
%t A253046   f[x_] := Which[PrimeQ[x/2], 3 NextPrime[x/2],
%t A253046     PrimeQ[x/3], 2 NextPrime[x/3, -1],
%t A253046 True, x];Array[f, n]]; a253046[67] (* _Michael De Vlieger_, Dec 27 2014 *)
%o A253046 (Haskell)
%o A253046 a253046 n | i == 0 || p > 3 = n
%o A253046           | p == 2          = 3 * a000040 (i + 1)
%o A253046           | otherwise       = 2 * a000040 (i - 1)
%o A253046             where i = a049084 (div n p);  p = a020639 n
%o A253046 -- _Reinhard Zumkeller_, Dec 26 2014
%o A253046 (Python)
%o A253046 from sympy import isprime, nextprime, prevprime
%o A253046 def A253046(n):
%o A253046     q2, r2 = divmod(n,2)
%o A253046     if not r2 and isprime(q2):
%o A253046         return 3*nextprime(q2)
%o A253046     else:
%o A253046         q3, r3 = divmod(n,3)
%o A253046         if not r3 and isprime(q3):
%o A253046             return 2*prevprime(q3)
%o A253046         return n # _Chai Wah Wu_, Dec 27 2014
%Y A253046 Cf. A064614, A251561, A020639, A049084, A000040, A253106, A001748, A100484.
%K A253046 nonn
%O A253046 1,2
%A A253046 _N. J. A. Sloane_, Dec 26 2014