login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A108546 Lexicographically earliest permutation of primes such that for n>1 forms 4*k+1 and 4*k+3 alternate. 19

%I #25 Feb 27 2020 22:48:32

%S 2,3,5,7,13,11,17,19,29,23,37,31,41,43,53,47,61,59,73,67,89,71,97,79,

%T 101,83,109,103,113,107,137,127,149,131,157,139,173,151,181,163,193,

%U 167,197,179,229,191,233,199,241,211,257,223,269,227,277,239,281,251,293

%N Lexicographically earliest permutation of primes such that for n>1 forms 4*k+1 and 4*k+3 alternate.

%H Reinhard Zumkeller, <a href="/A108546/b108546.txt">Table of n, a(n) for n = 1..10000</a>

%F a(n) mod 4 = 3 - 2 * (n mod 2) for n>1.

%F For n > 1: a(n) = A111745(n-1).

%F a(2*n+1) - a(2*n) = A102261(n).

%F From _Antti Karttunen_, Feb 27 2020: (Start)

%F a(1) = 2, a(2n) = A002145(n), a(2n+1) = A002144(n).

%F a(n) = A000040(A332807(n)).

%F (End)

%t 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 *)

%o (Haskell)

%o import Data.List (transpose)

%o a108546 n = a108546_list !! (n-1)

%o a108546_list = 2 : concat

%o (transpose [a002145_list, a002144_list])

%o -- _Reinhard Zumkeller_, Nov 13 2014, Feb 22 2011

%o (PARI)

%o up_to = 10000;

%o 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); };

%o v108546 = A108546list(up_to);

%o A108546(n) = v108546[n]; \\ _Antti Karttunen_, Feb 27 2020

%Y Cf. A000040, A002144, A002145, A102261, A108547 (fixed points), A108548, A111745, A332806 (inverse), A332807.

%Y Cf. also A267101, A332211.

%K nonn

%O 1,1

%A _Reinhard Zumkeller_, Jun 10 2005

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

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 24 20:08 EDT 2024. Contains 371963 sequences. (Running on oeis4.)