A282649 The larger term of the pair (a(n), a(n+1)) is always prime.
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
Keywords
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.
Links
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
Comments