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.

A203069 Lexicographically earliest sequence of distinct positive numbers such that a(n-1)+a(n) is odd and composite.

This page as a plain text file.
%I A203069 #52 Dec 23 2024 14:53:42
%S A203069 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,
%T A203069 29,28,27,30,33,32,31,34,35,40,37,38,39,36,41,44,43,42,45,46,47,48,51,
%U A203069 54,57,58,53,52,59,56,49,50,55,60,61,62,63,66,67,68,65
%N A203069 Lexicographically earliest sequence of distinct positive numbers such that a(n-1)+a(n) is odd and composite.
%C A203069 Inspired by an idea of Eric Angelini on the Sequence Fans list on Dec 28 2011.
%C A203069 Comments from _N. J. A. Sloane_, Aug 16 2021: (Start)
%C A203069 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?
%C A203069 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).
%C A203069 Also a(n) is surprisingly close to n - see A346611. (End)
%H A203069 Reinhard Zumkeller, <a href="/A203069/b203069.txt">Table of n, a(n) for n = 1..10000</a>
%H A203069 Éric Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2011-December/008780.html">A December quiz with a non-prime array</a>, SeqFan list, Dec 28 2011.
%H A203069 N. J. A. Sloane, <a href="/A203069/a203069_2.txt">Table of n, a(n) for n = 1..100000</a>
%H A203069 N. J. A. Sloane, <a href="/A203069/a203069_1.txt">Maple program</a>
%H A203069 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%e A203069 a(1)=1; the smallest possible even number m such that 1+m is composite is m=8, hence a(2)=8;
%e A203069 the smallest possible odd number m such that 8+m is composite is m=7, hence a(3)=7;
%e A203069 the smallest possible even number m such that 7+m is composite is m=2, hence a(4)=2.
%p A203069 (See link)
%t A203069 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 *)
%o A203069 (Sage)
%o A203069 @cached_function
%o A203069 def A203069(n):
%o A203069     if n == 1: return 1
%o A203069     used = set(A203069(i) for i in [1..n-1])
%o A203069     works = lambda an: (A203069(n-1)+an) % 2 == 1 and len(divisors((A203069(n-1)+an))) > 2
%o A203069     return next(k for k in PositiveIntegers() if k not in used and works(k)) # _D. S. McNeil_, Dec 28 2011
%o A203069 (Haskell)
%o A203069 import Data.List (delete)
%o A203069 a203069 n = a203069_list !! (n-1)
%o A203069 a203069_list = 1 : f 1 [2..] where
%o A203069    f u vs = g vs where
%o A203069      g (w:ws) | odd z && a010051' z == 0 = w : f w (delete w vs)
%o A203069               | otherwise = g ws
%o A203069               where z = u + w
%o A203069 -- _Reinhard Zumkeller_, Jan 14 2015
%Y A203069 Cf. A010051, A249918 (inverse), A014076, A055266, A346610 (first differences), A346611.
%Y A203069 See A346609 for the successive odd nonprimes that arise.
%K A203069 nonn
%O A203069 1,2
%A A203069 _Zak Seidov_, Dec 28 2011
%E A203069 Revised by _N. J. A. Sloane_, Aug 15 2021 at the suggestion of _Harvey P. Dale_.