login
A203069
Lexicographically earliest sequence of distinct positive numbers such that a(n-1)+a(n) is odd and composite.
8
1, 8, 7, 2, 13, 12, 3, 6, 9, 16, 5, 4, 11, 10, 15, 18, 17, 22, 23, 26, 19, 14, 21, 24, 25, 20, 29, 28, 27, 30, 33, 32, 31, 34, 35, 40, 37, 38, 39, 36, 41, 44, 43, 42, 45, 46, 47, 48, 51, 54, 57, 58, 53, 52, 59, 56, 49, 50, 55, 60, 61, 62, 63, 66, 67, 68, 65
OFFSET
1,2
COMMENTS
Inspired by an idea of Eric Angelini on the Sequence Fans list on Dec 28 2011.
Comments from N. J. A. Sloane, Aug 16 2021: (Start)
It is conjectured that this is a permutation of the positive integers. Is there a proof? The terms are distinct, by definition, and the sequence is clearly infinite. But does every number appear?
In the first 100000 terms, the only differences a(i)-a(i-1) that occur are -11, -9, -7, -5, -3, -1, 1, 3, 5, 7, 9, 11 (see A346610).
Also a(n) is surprisingly close to n - see A346611. (End)
EXAMPLE
a(1)=1; the smallest possible even number m such that 1+m is composite is m=8, hence a(2)=8;
the smallest possible odd number m such that 8+m is composite is m=7, hence a(3)=7;
the smallest possible even number m such that 7+m is composite is m=2, hence a(4)=2.
MAPLE
(See link)
MATHEMATICA
Clear[used]; used={1}; oc[n_]:=Module[{k=If[OddQ[n], 2, 1]}, While[ !CompositeQ[ n+k]||MemberQ[used, k], k+=2]; Flatten[AppendTo[used, k]]; k] (* Harvey P. Dale, Aug 16 2021 *)
PROG
(Sage)
@cached_function
def A203069(n):
if n == 1: return 1
used = set(A203069(i) for i in [1..n-1])
works = lambda an: (A203069(n-1)+an) % 2 == 1 and len(divisors((A203069(n-1)+an))) > 2
return next(k for k in PositiveIntegers() if k not in used and works(k)) # D. S. McNeil, Dec 28 2011
(Haskell)
import Data.List (delete)
a203069 n = a203069_list !! (n-1)
a203069_list = 1 : f 1 [2..] where
f u vs = g vs where
g (w:ws) | odd z && a010051' z == 0 = w : f w (delete w vs)
| otherwise = g ws
where z = u + w
-- Reinhard Zumkeller, Jan 14 2015
CROSSREFS
Cf. A010051, A249918 (inverse), A014076, A055266, A346610 (first differences), A346611.
See A346609 for the successive odd nonprimes that arise.
Sequence in context: A155068 A244839 A329450 * A343626 A272531 A244684
KEYWORD
nonn
AUTHOR
Zak Seidov, Dec 28 2011
EXTENSIONS
Revised by N. J. A. Sloane, Aug 15 2021 at the suggestion of Harvey P. Dale.
STATUS
approved