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.

A282649 The larger term of the pair (a(n), a(n+1)) is always prime.

Original entry on oeis.org

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

Views

Author

Eric Angelini and Jean-Marc Falcoz, Feb 20 2017

Keywords

Comments

The sequence is started with a(1) = 1 and always extended with the smallest integer not yet present and not leading to a contradiction. The sequence is a permutation of the positive integers.
From Bernard Schott, May 15 2019: (Start)
Let p_k = A000040(k) and c_k = A002808(k), the data can be written:
1, p_1, p_2, p_3, c_1, p_4, c_2, p_5, c_3, p_6, c_4, p_7, ...
At the 4th term, begins the alternating pattern:
{p_3, c_1, p_4, c_2, p_5, c_3, ..., p_(m+2), c_m, ...}.
The terms with odd index are 1, p_2, c_1, c_2, c_3, c_4, c_5, ...;
the terms with even index are p_1, p_3, p_4, p_5, p_6, p_7, ... This is A045344. (End)

Examples

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

Crossrefs

Cf. A000040 (prime numbers), A002808 (composite numbers), A045344.

Programs

  • Mathematica
    a = {1}; Do[k = 1; While[Nand[PrimeQ@ Max[a[[n - 1]], k], ! MemberQ[a, k]], k++]; AppendTo[a, k], {n, 2, 120}]; a (* Michael De Vlieger, Feb 20 2017 *)

Formula

From Bernard Schott, May 15 2019: (Start)
n odd: a(1) = 1, a(3) = 3, and for n >= 5, a(n) = A002808((n-3)/2).
n even: a(2) = 2, for n >= 4, a(n) = A000040(n/2 + 1), also,
n even: a(n) = A045344(n/2). (End)
For n > 4, if a(n-1) is prime then a(n) is the smallest composite > a(n-2); otherwise a(n) is the smallest prime > a(n-2). - Bill McEachen, Apr 27 2024