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.

A267107 "Chebyshev's bat permutation": a(1) = 1, a(A080147(n)) = A080148(a(n)), a(A080148(n)) = A080147(a(n)).

This page as a plain text file.
%I A267107 #31 Jan 04 2025 15:17:02
%S A267107 1,3,2,7,6,5,4,16,13,14,12,11,9,10,35,8,29,31,30,26,23,25,21,27,22,20,
%T A267107 24,74,17,19,18,62,67,66,15,65,54,57,51,58,55,56,45,48,43,59,50,44,53,
%U A267107 47,39,152,49,37,41,42,38,40,46,144,130,32,139,137,36,34,33,118,136,129,128,113,121,28,108,122,125
%N A267107 "Chebyshev's bat permutation": a(1) = 1, a(A080147(n)) = A080148(a(n)), a(A080148(n)) = A080147(a(n)).
%C A267107 This is a self-inverse permutation of natural numbers.
%H A267107 Antti Karttunen, <a href="/A267107/b267107.txt">Table of n, a(n) for n = 1..10001</a>
%H A267107 Antti Karttunen, <a href="/A135141/a135141.pdf">Entanglement Permutations</a>, 2016-2017.
%H A267107 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A267107 a(1) = 1; and for n > 1, if prime(n) modulo 4 = 1, a(n) = A080148(a(A267097(n))), otherwise a(n) = A080147(a(A267098(n))).
%o A267107 (PARI)
%o A267107 allocatemem(2^30);
%o A267107 default(primelimit,4294965247);
%o A267107 uplim = 2^20;
%o A267107 uplim2 = 366824; \\ Very ad hoc.
%o A267107 v080147 = vector(uplim);
%o A267107 v080148 = vector(uplim);
%o A267107 v267097 = vector(uplim);
%o A267107 v267107 = vector(uplim);
%o A267107 v267097[1] = 0; c = 0; v47i = 0; v48i = 0; for(n=2, uplim, if((1 == (prime(n)%4)), c++; v47i++; v080147[v47i] = n, v48i++; v080148[v48i] = n); v267097[n] = c; if(!(n%32768),print1(" n=",n)));
%o A267107 A080147(n) = v080147[n];
%o A267107 A080148(n) = v080148[n];
%o A267107 A267097(n) = v267097[n];
%o A267107 A267098(n) = (n - A267097(n))-1;
%o A267107 A267107(n) = v267107[n];
%o A267107 v267107[1] = 1; for(n=2, uplim2, if((1 == (prime(n) % 4)), v267107[n] = A080148(A267107(A267097(n))), v267107[n] = A080147(A267107(A267098(n))));  if(!(n%32768),print1(" n=",n)));
%o A267107 for(n=1, uplim2, write("b267107.txt", n, " ", A267107(n)));
%o A267107 (Scheme)
%o A267107 ;; With memoization-macro definec
%o A267107 (definec (A267107 n) (cond ((<= n 1) n) ((= 1 (modulo (A000040 n) 4)) (A080148 (A267107 (A267097 n)))) (else (A080147 (A267107 (A267098 n))))))
%Y A267107 Cf. A000040, A002144, A002145, A038698, A080147, A080148, A267097, A267098.
%Y A267107 Cf. A268393 (record positions), A268394 (record values).
%Y A267107 Cf. A267100, A267105, A267106 and also A270193, A270194, A270199, A270201, A270202 for other similarly constructed permutations based on prime distribution biases.
%K A267107 nonn,look
%O A267107 1,2
%A A267107 _Antti Karttunen_, Feb 01 2016
%E A267107 Name changed, the old name was "Manta moth permutation" - _Antti Karttunen_, Dec 10 2019