login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A203069 Alternating-parity rearrangement of natural numbers: a(n) is the smallest number such that a(n-1)+a(n) is odd and composite. 5
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 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,2

COMMENTS

Inspired by idea of Eric Angelini at SeqFan list Dec 28 2011.

LINKS

Reinhard Zumkeller, Table of n, a(n) for n = 1..10000

√Čric Angelini, A December quiz with a non-prime array, SeqFan list, Dec 28 2011.

Index entries for sequences that are permutations of the natural numbers

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.

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.

Sequence in context: A198928 A155068 A244839 * A272531 A244684 A201742

Adjacent sequences:  A203066 A203067 A203068 * A203070 A203071 A203072

KEYWORD

nonn

AUTHOR

Zak Seidov, Dec 28 2011

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 13:31 EDT 2019. Contains 322461 sequences. (Running on oeis4.)