A267107 "Chebyshev's bat permutation": a(1) = 1, a(A080147(n)) = A080148(a(n)), a(A080148(n)) = A080147(a(n)).
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, 24, 74, 17, 19, 18, 62, 67, 66, 15, 65, 54, 57, 51, 58, 55, 56, 45, 48, 43, 59, 50, 44, 53, 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
Offset: 1
Links
- Antti Karttunen, Table of n, a(n) for n = 1..10001
- Antti Karttunen, Entanglement Permutations, 2016-2017.
- Index entries for sequences that are permutations of the natural numbers
Crossrefs
Programs
-
PARI
allocatemem(2^30); default(primelimit,4294965247); uplim = 2^20; uplim2 = 366824; \\ Very ad hoc. v080147 = vector(uplim); v080148 = vector(uplim); v267097 = vector(uplim); v267107 = vector(uplim); 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))); A080147(n) = v080147[n]; A080148(n) = v080148[n]; A267097(n) = v267097[n]; A267098(n) = (n - A267097(n))-1; A267107(n) = v267107[n]; 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))); for(n=1, uplim2, write("b267107.txt", n, " ", A267107(n)));
-
Scheme
;; With memoization-macro definec (definec (A267107 n) (cond ((<= n 1) n) ((= 1 (modulo (A000040 n) 4)) (A080148 (A267107 (A267097 n)))) (else (A080147 (A267107 (A267098 n))))))
Formula
Extensions
Name changed, the old name was "Manta moth permutation" - Antti Karttunen, Dec 10 2019
Comments