login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A108546
Lexicographically earliest permutation of primes such that for n>1 forms 4*k+1 and 4*k+3 alternate.
19
2, 3, 5, 7, 13, 11, 17, 19, 29, 23, 37, 31, 41, 43, 53, 47, 61, 59, 73, 67, 89, 71, 97, 79, 101, 83, 109, 103, 113, 107, 137, 127, 149, 131, 157, 139, 173, 151, 181, 163, 193, 167, 197, 179, 229, 191, 233, 199, 241, 211, 257, 223, 269, 227, 277, 239, 281, 251, 293
OFFSET
1,1
LINKS
FORMULA
a(n) mod 4 = 3 - 2 * (n mod 2) for n>1.
For n > 1: a(n) = A111745(n-1).
a(2*n+1) - a(2*n) = A102261(n).
From Antti Karttunen, Feb 27 2020: (Start)
a(1) = 2, a(2n) = A002145(n), a(2n+1) = A002144(n).
a(n) = A000040(A332807(n)).
(End)
MATHEMATICA
terms = 60; A111745 = Module[{prs = Prime[Range[2terms]], m3, m1, min}, m3 = Select[prs, Mod[#, 4] == 3&]; m1 = Select[prs, Mod[#, 4] == 1&]; min = Min[Length[m1], Length[m3]]; Riffle[Take[m3, min], Take[m1, min]]]; a[1] = 2; a[n_] := A111745[[n-1]]; Table[a[n], {n, 1, terms}] (* Jean-François Alcover, May 18 2017, using Harvey P. Dale's code for A111745 *)
PROG
(Haskell)
import Data.List (transpose)
a108546 n = a108546_list !! (n-1)
a108546_list = 2 : concat
(transpose [a002145_list, a002144_list])
-- Reinhard Zumkeller, Nov 13 2014, Feb 22 2011
(PARI)
up_to = 10000;
A108546list(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); (v); };
v108546 = A108546list(up_to);
A108546(n) = v108546[n]; \\ Antti Karttunen, Feb 27 2020
CROSSREFS
Cf. A000040, A002144, A002145, A102261, A108547 (fixed points), A108548, A111745, A332806 (inverse), A332807.
Cf. also A267101, A332211.
Sequence in context: A126054 A067836 A332806 * A065107 A338944 A351528
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Jun 10 2005
STATUS
approved