OFFSET
1,2
COMMENTS
This is a permutation of the natural numbers > 0.
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
Eric Angelini, Parity given by first digit of the previous term
E. Angelini, Parity given by first digit of the previous term [Cached copy, with permission]
PROG
(Haskell)
import Data.List (delete)
a238704 n = a238704_list !! (n-1)
a238704_list = 1 : f 1 [2..] where
f x zs = g zs where
g (y:ys) =
if y `mod` 2 /= m then g ys else y : f y (delete y zs)
m = a000030 x `mod` 2
-- Reinhard Zumkeller, Mar 03 2014
CROSSREFS
KEYWORD
AUTHOR
Eric Angelini, Mar 03 2014
STATUS
approved