editing
approved
editing
approved
(Haskell)
import Data.Set (singleton, member, insert)
a110080 n = a110080_list !! (n-1)
a110080_list = 1 : f 1 a000040_list (singleton 1) where
f x (p:ps) m = y : f y ps (insert y m) where
y = g x p
g 0 _ = h x p
g u 0 = u
g u v = g (u - 1) (if member (u - 1) m then v else v - 1)
h u 0 = u
h u v = h (u + 1) (if member (u + 1) m then v else v - 1)
-- Reinhard Zumkeller, Sep 02 2014
Reinhard Zumkeller, <a href="/A110080/b110080.txt">Table of n, a(n) for n = 1..10000</a>
approved
editing
proposed
approved
editing
proposed
a(5) is 2. Counting p(5) = 11 down from 2 gets a negative integer. So we instead count up 11 positions, skipping the 3, 6 and 11 as we count, to arrive at 16 (which is at the rightmost * of the number line above).
instead count up 11 positions -- skipping the 3, 6 and 11 as we count -- to arrive at 16 (which is at the right-most * of the number-line above).
approved
editing
Leroy Quet , Oct 12 2005
_Leroy Quet _ Oct 12 2005
More terms from Klaus Brockhaus and _Hans Havermann (gladhobo(AT)teksavvy.com), _, Oct 17 2005
More terms from _Klaus Brockhaus (klaus-brockhaus(AT)t-online.de) _ and Hans Havermann (gladhobo(AT)teksavvy.com), Oct 17 2005