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.

A346150 Alternating runs of primes and composites, with the runs of primes being of composite length and the runs of composites being of prime length.

This page as a plain text file.
%I A346150 #22 Oct 28 2021 03:58:48
%S A346150 2,4,6,3,5,7,11,8,9,10,13,17,19,23,29,31,12,14,15,16,18,37,41,43,47,
%T A346150 53,59,61,67,20,21,22,24,25,26,27,71,73,79,83,89,97,101,103,107,28,30,
%U A346150 32,33,34,35,36,38,39,40,42
%N A346150 Alternating runs of primes and composites, with the runs of primes being of composite length and the runs of composites being of prime length.
%C A346150 In other words, use sequence A073846 to list alternating runs of primes and composites, with the number of elements in each run given by successive terms in A073846 - with each even-indexed term of A073846 (being itself prime) denoting the length of each run of composites and each odd-indexed term of A073846 (being itself composite) denoting the length of each run of primes.
%e A346150 a(1) = 2, this being a length 1 (1 is initial index) run of primes.
%e A346150 a(2) = 4 & a(3) = 6, 4 and 6 being a length 2 (2 is first prime) run of composites.
%e A346150 a(4) = 3, a(5) = 5, a(6) = 7, and a(7) = 11 being a length 4 (4 is first composite) run of primes.
%e A346150 a(8) = 8, a(9) = 9, and a(10) = 10, being a length 3 (3 is 2nd prime) run of composites.
%t A346150 m=10;c1=Select[Range@m,!PrimeQ@#&];p1=Prime@Range@Total@c1;p2=Prime@Range@m;c2=Select[Range[2,2Total@p2],!PrimeQ@#&][[;;Total@p2]];t1=TakeList[p1,c1];t2=TakeList[c2,p2];min=Min[Length/@{t1,t2}];Flatten@Riffle[t1[[;;min]],t2[[;;min]]] (* _Giorgos Kalogeropoulos_, Jul 30 2021 *)
%Y A346150 Cf. A000040 (primes), A002808 (composites), A073846.
%K A346150 nonn,easy
%O A346150 1,1
%A A346150 _Walter Carlini_, Jul 07 2021