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.

Showing 1-5 of 5 results.

A267099 Fully multiplicative involution swapping the positions of 4k+1 and 4k+3 primes: a(1) = 1; a(prime(k)) = A267101(k), a(x*y) = a(x)*a(y) for x, y > 1.

Original entry on oeis.org

1, 2, 5, 4, 3, 10, 13, 8, 25, 6, 17, 20, 7, 26, 15, 16, 11, 50, 29, 12, 65, 34, 37, 40, 9, 14, 125, 52, 19, 30, 41, 32, 85, 22, 39, 100, 23, 58, 35, 24, 31, 130, 53, 68, 75, 74, 61, 80, 169, 18, 55, 28, 43, 250, 51, 104, 145, 38, 73, 60, 47, 82, 325, 64, 21, 170, 89, 44, 185, 78, 97, 200, 59, 46, 45, 116, 221, 70, 101
Offset: 1

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Comments

Lexicographically earliest self-inverse permutation of natural numbers where each prime of the form 4k+1 is replaced by a prime of the form 4k+3 and vice versa, with the composite numbers determined by multiplicativity.
Fully multiplicative with a(p_n) = p_{A267100(n)} = A267101(n).
Maps each term of A004613 to some term of A004614, each (nonzero) term of A001481 to some term of A268377 and each term of A004431 to some term of A268378 and vice versa.
Sequences A072202 and A078613 are closed with respect to this permutation.

Crossrefs

Cf. A000035, A000040, A000720, A010051, A020639, A032742, A267100, A267101, A354102 (Möbius transform), A354103 (inverse Möbius transform), A354192 (fixed points).
Cf. also A108548.

Programs

  • PARI
    up_to = 2^16;
    A267097list(up_to) = { my(v=vector(up_to),i=0,c=0); forprime(p=2,prime(up_to), if(1==(p%4), c++); i++; v[i] = c); (v); };
    v267097 = A267097list(up_to);
    A267097(n) = v267097[n];
    A267098(n) = ((n-1)-A267097(n));
    list_primes_of_the_form(up_to,m,k) = { my(v=vector(up_to),i=0); forprime(p=2,, if(k==(p%m), i++; v[i] = p; if(i==up_to,return(v)))); };
    v002144 = list_primes_of_the_form(2*up_to,4,1);
    A002144(n) = v002144[n];
    v002145 = list_primes_of_the_form(2*up_to,4,3);
    A002145(n) = v002145[n];
    A267101(n) = if(1==n,2,if(1==(prime(n)%4),A002145(A267097(n)),A002144(A267098(n))));
    A267099(n) = { my(f=factor(n)); for(k=1,#f~,f[k,1] = A267101(primepi(f[k,1]))); factorback(f); }; \\ Antti Karttunen, May 18 2022
    (Scheme, with memoization-macro definec)
    (definec (A267099 n) (cond ((<= n 1) n) ((= 1 (A010051 n)) (A267101 (A000720 n))) (else (* (A267099 (A020639 n)) (A267099 (A032742 n))))))

Formula

a(1) = 1; after which, if n is k-th prime [= A000040(k)], then a(n) = A267101(k), otherwise a(A020639(n)) * a(A032742(n)).
Other identities. For all n >= 1:
a(A000040(n)) = A267101(n).
a(2*n) = 2*a(n).
a(3*n) = 5*a(n).
a(5*n) = 3*a(n).
a(7*n) = 13*a(n).
a(11*n) = 17*a(n).
etc. See examples in A267101.
A000035(n) = A000035(a(n)). [Preserves the parity of n.]
A005094(a(n)) = -A005094(n).
A079635(a(n)) = -A079635(n).

Extensions

Verbal description prefixed to the name by Antti Karttunen, May 19 2022

A267101 2 followed by permutation of odd primes, where each n-th prime of the form 4k+1 (A002144) has been replaced with the n-th prime of the form 4k+3 (A002145) and vice versa.

Original entry on oeis.org

2, 5, 3, 13, 17, 7, 11, 29, 37, 19, 41, 23, 31, 53, 61, 43, 73, 47, 89, 97, 59, 101, 109, 67, 71, 79, 113, 137, 83, 103, 149, 157, 107, 173, 127, 181, 131, 193, 197, 139, 229, 151, 233, 163, 167, 241, 257, 269, 277, 179, 191, 281, 199, 293, 211, 313, 223, 317, 227, 239, 337, 251, 349, 353, 263, 271, 373, 283, 389
Offset: 1

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Comments

After 2, for each n >= 1, swap the places of primes A002144(n) and A002145(n) in A000040.

Examples

			For n=2, for which A000040(2) = 3, the first prime of the form 4k+3, we select the first prime of the form 4k+1, which is 5, thus a(2) = 5.
For n=3, for which A000040(3) = 5, the first prime of the form 4k+1, we select the first prime of the form 4k+3, which is 3, thus a(3) = 3.
For n=4, for which A000040(4) = 7, the second prime of the form 4k+3, we select the second prime of the form 4k+1, which is 13, thus a(4) = 13.
For n=5, for which A000040(5) = 11, the third prime of the form 4k+3, we select the third prime of the form 4k+1, which is 17, thus a(5) = 17.
		

Crossrefs

Programs

Formula

a(1) = 2; after which, if prime(n) modulo 4 = 1, a(n) = A002145(A267097(n)), otherwise a(n) = A002144(A267098(n)).
a(n) = A000040(A267100(n)).
a(n) = A267099(A000040(n)).

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

Original entry on oeis.org

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

Views

Author

Antti Karttunen, Feb 01 2016

Keywords

Comments

This is a self-inverse permutation of natural numbers.

Crossrefs

Cf. A268393 (record positions), A268394 (record values).
Cf. A267100, A267105, A267106 and also A270193, A270194, A270199, A270201, A270202 for other similarly constructed permutations based on prime distribution biases.

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

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

Extensions

Name changed, the old name was "Manta moth permutation" - Antti Karttunen, Dec 10 2019

A332805 a(n) = A000720(A332806(n)).

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 7, 8, 10, 9, 12, 11, 13, 14, 16, 15, 18, 17, 20, 22, 19, 24, 26, 21, 23, 25, 28, 30, 27, 29, 32, 34, 31, 36, 33, 38, 35, 40, 42, 37, 44, 39, 46, 41, 43, 48, 50, 52, 54, 45, 47, 56, 49, 58, 51, 60, 53, 62, 55, 57, 64, 59, 66, 68, 61, 63, 70, 65, 72, 67, 69, 74, 76, 71, 78, 80, 73, 75, 77, 79, 82, 81, 84, 83, 86, 88, 85
Offset: 1

Views

Author

Antti Karttunen, Feb 27 2020

Keywords

Crossrefs

Cf. A000040, A108546, A332806, A332807 (inverse permutation).
Fixed points are given by A000720(A108547(n)), n>=1.
Cf. also A267100.

Programs

  • PARI
    up_to = 10000;
    A332805list(up_to) = { my(v=vector(2), xs=Map(), lista=List([]), p,q); v[2] = 3; v[1] = 5; mapput(xs,1,1); mapput(xs,2,2); mapput(xs,3,3);  for(n=4,up_to, p = v[2-(n%2)]; q = nextprime(1+p); while(q%4 != p%4, q=nextprime(1+q)); v[2-(n%2)] = q; mapput(xs,primepi(q),n)); for(i=1, oo, if(!mapisdefined(xs, i, &u), return(Vec(lista)), listput(lista, u))); };
    v332805 = A332805list(up_to);
    A332805(n) = v332805[n];

Formula

For all n >= 1, A108546(a(n)) = A000040(n).

A332807 a(n) = A000720(A108546(n)).

Original entry on oeis.org

1, 2, 3, 4, 6, 5, 7, 8, 10, 9, 12, 11, 13, 14, 16, 15, 18, 17, 21, 19, 24, 20, 25, 22, 26, 23, 29, 27, 30, 28, 33, 31, 35, 32, 37, 34, 40, 36, 42, 38, 44, 39, 45, 41, 50, 43, 51, 46, 53, 47, 55, 48, 57, 49, 59, 52, 60, 54, 62, 56, 65, 58, 66, 61, 68, 63, 70, 64, 71, 67, 74, 69, 77, 72, 78, 73, 79, 75, 80, 76, 82, 81, 84, 83, 87, 85, 88, 86
Offset: 1

Views

Author

Antti Karttunen, Feb 27 2020

Keywords

Crossrefs

Cf. A332805 (inverse permutation).
Fixed points are given by A000720(A108547(n)), n>=1.
Cf. also A267100.

Programs

  • PARI
    up_to = 50507;
    A332807list(up_to) = { my(v=vector(up_to), p,q); v[1] = 2; v[2] = 3; v[3] = 5; for(n=4,up_to, p = v[n-2]; q = nextprime(1+p); while(q%4 != p%4, q=nextprime(1+q)); v[n] = q); apply(primepi,v); };
    v332807 = A332807list(up_to);
    A332807(n) = v332807[n];

Formula

a(n) = A000720(A108546(n)).
Showing 1-5 of 5 results.