login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A267107 "Manta moth permutation": a(1) = 1, a(A080147(n)) = A080148(a(n)), a(A080148(n)) = A080147(a(n)). 8
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

This is self-inverse permutation of natural numbers.

LINKS

Antti Karttunen, Table of n, a(n) for n = 1..10001

Index entries for sequences that are permutations of the natural numbers

FORMULA

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))).

PROG

(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))))))

CROSSREFS

Cf. A000040, A002144, A002145, A080147, A080148, A267097, A267098.

Cf. A268393 (record positions), A268394 (record values).

Cf. also A267100, A267105, A267106.

Sequence in context: A054429 A269398 A269397 * A126316 A101224 A229120

Adjacent sequences:  A267104 A267105 A267106 * A267108 A267109 A267110

KEYWORD

nonn,look

AUTHOR

Antti Karttunen, Feb 01 2016

STATUS

approved

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

License Agreements, Terms of Use, Privacy Policy .

Last modified May 26 21:38 EDT 2018. Contains 304645 sequences. (Running on oeis4.)