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.

Previous Showing 11-18 of 18 results.

A067747 Primes interleaved between composite numbers: n-th prime followed by the n-th composite number.

Original entry on oeis.org

2, 4, 3, 6, 5, 8, 7, 9, 11, 10, 13, 12, 17, 14, 19, 15, 23, 16, 29, 18, 31, 20, 37, 21, 41, 22, 43, 24, 47, 25, 53, 26, 59, 27, 61, 28, 67, 30, 71, 32, 73, 33, 79, 34, 83, 35, 89, 36, 97, 38, 101, 39, 103, 40, 107, 42, 109, 44, 113, 45, 127, 46, 131, 48, 137, 49, 139
Offset: 1

Views

Author

Amarnath Murthy, Feb 26 2002

Keywords

Comments

a(2*n-1) = A000040(n); a(2*n) = A002808(n). - Reinhard Zumkeller, Jan 29 2014

Examples

			For n=4, the index is even. Therefore a(4)=A002808(4/2)=A002808(2)=6.
		

Crossrefs

Programs

  • Haskell
    import Data.List (transpose)
    a067747 n = a067747_list !! (n-1)
    a067747_list = concat $ transpose [a000040_list, a002808_list]
    -- Reinhard Zumkeller, Jan 29 2014
    
  • Maple
    P,C:= selectremove(isprime,[$2..1000]):
    seq(op([P[i],C[i]]),i=1..min(nops(P),nops(C))); # Robert Israel, Jul 24 2015
  • Mathematica
    Array[c,1000];pc=-1;nc=0;Do[If[PrimeQ[n],If[pc==999,Break[],pc+=2;c[pc]=n],If[nc<=998,nc+=2;c[nc]=n,Goto[ne]]];Label[ne],{n,2,20000}];Table[c[i],{i,1000}] (* Zak Seidov, Mar 22 2008 *)
    Composite[n_Integer] := FixedPoint[n + PrimePi@ # + 1 &, n + PrimePi@ n + 1]; Table[{Prime@ n, Composite@ n}, {n, 35}] // Flatten (* Robert G. Wilson v, Jun 08 2008 *)
  • PARI
    c(n) = for(k=0, primepi(n), isprime(n++)&&k--); n; \\ A002808
    a(n) = if (n%2, prime((n+1)/2), c((n+1)\2)); \\ Michel Marcus, Mar 06 2021

Formula

a(2*n-1) = A000040(n); a(2*n) = A002808(n). - Reinhard Zumkeller, Jan 29 2014
a(n) = A000040(ceiling(n/2))*A000035(n) + A002808(ceiling(n/2))*A059841(n), equivalent to the Zumkeller formula. - Chayim Lowen, Jul 29 2015

A244724 Lexicographically earliest permutation of the natural numbers such that primes and composites alternate in the sums of adjacent terms.

Original entry on oeis.org

1, 2, 4, 3, 5, 6, 8, 9, 7, 10, 11, 12, 13, 16, 14, 15, 17, 20, 18, 19, 21, 22, 23, 24, 25, 28, 26, 27, 29, 30, 32, 35, 31, 36, 33, 34, 38, 41, 37, 42, 39, 40, 44, 45, 43, 46, 47, 50, 48, 49, 51, 52, 53, 54, 56, 57, 55, 58, 59, 68, 60, 67, 61, 66, 62, 65, 63
Offset: 1

Views

Author

Reinhard Zumkeller, Jul 05 2014

Keywords

Comments

For k > 0: a(2*k-1) + a(2*k) is prime, a(2*k) + a(2*k+1) is composite.

Examples

			.             n | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
.          a(n) | 1 2 4 3 5 6 8 9 7 10 11 12 13 16 14 15 17 20 18 19
. A026233(a(n)) | 1 1 2 2 3 3 4 5 4  6  5  7  6 10  8  9  7 12 11  8 .
		

Crossrefs

Cf. A244732 (inverse), A244731 (fixed points), A073846, A113321, A115316.

Programs

  • Haskell
    import Data.List (delete)
    a244724 n = a244724_list !! (n-1)
    a244724_list = 1 : f 1 [2..] where
       f x xs = f' xs where
         f' (u:us) | a010051' (x + u) == 1 = g u (delete u xs)
                   | otherwise             = f' us where
            g y ys = g' ys where
              g' (v:vs) | a010051' (y + v) == 0 = u : v : f v (delete v ys)
                        | otherwise        = g' vs

Formula

A010051(a(n)+a(n+1)) = n mod 2.

A129131 Alternately write composite and prime numbers.

Original entry on oeis.org

4, 2, 6, 3, 8, 5, 9, 7, 10, 11, 12, 13, 14, 17, 15, 19, 16, 23, 18, 29, 20, 31, 21, 37, 22, 41, 24, 43, 25, 47, 26, 53, 27, 59, 28, 61, 30, 67, 32, 71, 33, 73, 34, 79, 35, 83, 36, 89, 38, 97, 39, 101, 40, 103, 42, 107, 44, 109, 45, 113, 46, 127, 48, 131, 49, 137, 50, 139, 51
Offset: 1

Views

Author

Edwin F. Sampang, Mar 30 2007

Keywords

Comments

a(2n-1) = A073846(2n+1), a(2n) = A073846(2n).

Examples

			Lowest composite number is 4, lowest prime number is 2, next composite number after 4 is 6, next prime number after 2 is 3 and so on.
		

Crossrefs

Cf. A000040 (prime numbers), A002808 (composite numbers), A073846 (alternate nonprime and prime numbers).

Programs

  • Magma
    P:=[ n : n in [2..150] | IsPrime(n) ]; C:=[ n : n in [2..70] | not IsPrime(n) ]; &cat[ [C[k], P[k] ]: k in [1..Minimum(#C, #P)] ]; // Klaus Brockhaus, Mar 31 2007
  • Mathematica
    f[n_]:=Module[{prs=Prime[Range[n]],comps},comps=Rest[Complement[Range[n+ Length[prs]+1], prs]];Riffle[comps,prs]] (* Harvey P. Dale, May 10 2011 *)

Formula

a(n) = A066249(n) + 1. - Filip Zaludek, Dec 10 2016

Extensions

Edited and extended by Klaus Brockhaus, Mar 31 2007

A271363 Irregular triangle read by rows: T(0, 0) = 2; T(i, j) is the j-th term in the least maximal chain of composites that is longer than the (i-1)-st least maximal chain of composites, where i>0.

Original entry on oeis.org

2, 4, 3, 14, 15, 17, 18, 21, 25, 31, 40, 55, 77, 111, 163, 50, 69, 99, 147, 225, 353, 60, 85, 123, 185, 285, 447, 721, 1185, 1981, 3363, 5777, 10039, 82, 119, 177, 273, 429, 693, 1135, 1891, 3201, 5497, 9543, 16723, 29579, 52737, 94705, 171147, 311101
Offset: 0

Views

Author

Hartmut F. W. Hoft, Apr 05 2016

Keywords

Comments

Call a sequence a_0, ..., a_k, k>=0, such that a_0 is even, a_k is prime, a_1,...,a_(k-1) are composite and a_(i+1) = 2*A065855(a_i) + 1 for 0 <= i < k a maximal chain of composites.
Since A065855 is nondecreasing the rows and columns of the triangle, respectively, are increasing starting with row 2.
T(n,0) is the least number starting a maximal chain of composites that is longer than the chain in row n-1.
T(n,j) = 2*A065855(T(n,j-1)) + 1 for n>=0, j>0 and T(n,j-1) composite.
Are there infinitely many rows? Are there rows of infinite length? (see A263570)

Examples

			a(0) = T(0, 0) = 2 since 2 is an even prime.
a(5) = T(2,2) = 17 since 2*A065855(2*A065855(T(2,0))+1)+1 = 2*A065855(2*A065855(14)+1)+1 = 2*A065855(2*7+1)+1 = 2*A065855(15)+1 = 2*8+1 = 17 and the maximal chain of composites starting at 14 is the first of length 3.
The triangle T(i, j) with complete rows 0..6 and parts of rows 7 and 8:
--------------------------------------------------------------------------
i\j  0   1    2    3    4    5     6     7     8     9     10     11  ...
--------------------------------------------------------------------------
0:   2
1:   4   3
2:  14  15   17
3:  18  21   25   31
4:  40  55   77  111  163
5:  50  69   99  147  225  353
6:  60  85  123  185  285  447   721  1185  1981  3363   5777  10039
7:  82 119  177  273  429  693  1135  1891  3201  5497   9543  16723  ...
8: 490 793 1309 2189 3723 6407 11145 19591 34737 62055 111633 202093  ...
The entire right boundary of the triangle is A263570.
All numbers in the triangle through T(8, 31) can be found in the link.
		

Crossrefs

Programs

  • Mathematica
    (* a271363[n] computes a maximal chain of composites starting at n *)
    composites[{m_, n_}] := Module[{i, count=0}, For[i=m, i<=n, i++, If[CompositeQ[i], count++]]; count]
    a271363[n_] := Module[{i=n, j=composites[{0, n}], h, list={}}, While[CompositeQ[i], AppendTo[list, {i, j}]; h=composites[{i, 2*j+1}]; i=2*j+1; j+=h-1]; AppendTo[list, {i, j}]]
    Map[First, ax271363[82]] (* computes row 7 *)

A093459 Terms of A093458 which are factorials.

Original entry on oeis.org

1, 2, 24, 720, 40320, 362880, 39916800, 6227020800
Offset: 1

Views

Author

Amarnath Murthy, Apr 03 2004

Keywords

Crossrefs

A088636 a(1) = 1, a(2n+1) - a(2n) = composite(n), a(2n) - a(2n-1) = prime(n).

Original entry on oeis.org

1, 3, 7, 10, 16, 21, 29, 36, 45, 56, 66, 79, 91, 108, 122, 141, 156, 179, 195, 224, 242, 273, 293, 330, 351, 392, 414, 457, 481, 528, 553, 606, 632, 691, 718, 779, 807, 874, 904, 975, 1007, 1080, 1113, 1192, 1226, 1309, 1344, 1433, 1469, 1566, 1604, 1705
Offset: 1

Views

Author

Amarnath Murthy, Oct 26 2003

Keywords

Crossrefs

Partial sums of A073846.

Extensions

More terms from David Wasserman, Aug 16 2005

A308598 The smaller term of the pair (a(n), a(n+1)) is always prime and in each pair there is a composite number; a(1) = 2 and the sequence is always extended with the smallest integer not yet present and not leading to a contradiction.

Original entry on oeis.org

2, 4, 3, 6, 5, 8, 7, 12, 11, 14, 13, 18, 17, 20, 19, 24, 23, 30, 29, 32, 31, 38, 37, 42, 41, 44, 43, 48, 47, 54, 53, 60, 59, 62, 61, 68, 67, 72, 71, 74, 73, 80, 79, 84, 83, 90, 89, 98, 97, 102, 101, 104, 103, 108, 107, 110, 109, 114, 113, 128, 127, 132, 131, 138, 137, 140, 139, 150, 149
Offset: 1

Views

Author

Bernard Schott, Jun 09 2019

Keywords

Comments

The idea of this sequence comes from A282649 where "larger" replaces "smaller".
The sequence is not a permutation of the positive integers.
The 1st bisection is A000040 (the primes) and the 2nd bisection is A008864 \ {3} (prime(n) + 1).
Consecutive primes p < q separated by composites c = q + 1. - Michael De Vlieger, Jun 09 2019

Examples

			In the 1st pair of integers (2,4) the smaller term is (2), which is prime;
In the 2nd pair of integers (4,3) the smaller term is (3), which is prime;
In the 3rd pair of integers (3,6) the smaller term is (3), which is prime;
In the 4th pair of integers (6,5) the smaller term is (5), which is prime;
In the 5th pair of integers (5,8) the smaller term is (5), which is prime; etc.
		

Crossrefs

Cf. A000040 (prime numbers), A002808 (composite numbers), A008864 (prime(n) + 1).
Cf. A282649 (similar, with larger term).
Cf. A067747, A073846, A073898 (sequences with same start).

Programs

  • Mathematica
    Fold[Join[#1, {#2, NextPrime@ #2 + 1}] &, {#, NextPrime@ # + 1} &@ 2, Prime@ Range[2, 35]] (* Michael De Vlieger, Jun 09 2019 *)

Formula

n odd: a(n) = prime((n+1)/2) = A000040((n+1)/2).
n even: a(n) = a(n+1) + 1 = prime(n/2 + 1) + 1 = A008864(n/2 + 1).
Alternatively, if a(n-1) is prime, a(n) = 1 + min prime > a(n-1) else a(n) = a(n-1) - 1. - Bill McEachen, May 16 2024

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.

Original entry on oeis.org

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, 53, 59, 61, 67, 20, 21, 22, 24, 25, 26, 27, 71, 73, 79, 83, 89, 97, 101, 103, 107, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42
Offset: 1

Views

Author

Walter Carlini, Jul 07 2021

Keywords

Comments

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.

Examples

			a(1) = 2, this being a length 1 (1 is initial index) run of primes.
a(2) = 4 & a(3) = 6, 4 and 6 being a length 2 (2 is first prime) run of composites.
a(4) = 3, a(5) = 5, a(6) = 7, and a(7) = 11 being a length 4 (4 is first composite) run of primes.
a(8) = 8, a(9) = 9, and a(10) = 10, being a length 3 (3 is 2nd prime) run of composites.
		

Crossrefs

Cf. A000040 (primes), A002808 (composites), A073846.

Programs

  • Mathematica
    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 *)
Previous Showing 11-18 of 18 results.