OFFSET
1,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 1..10000
EXAMPLE
. 1 5 10 15 20 25 30 35 40 45 50 55 60
. ....v....x....v....x....v....x....v....x....v....x....v....x....
. 12345678910111213141516171819202122232425262728293031323334353...
. ||| | | | | |
. ||| | | | | |
. ||| | | | | +--- A116700(8) = 42
. ||| | | | | -> a(8) = 39
. ||| | | | |
. ||| | | | +--- A116700(5) = 32
. ||| | | | -> a(5) = 37
. ||| | | |
. ||| | | + --- A116700(7) = 41 -> a(7) = 19
. ||| | |
. ||| | +--- A116700(4) = 31 -> a(4) = 17
. ||| |
. ||| +--- A116700(2) = 21 -> a(2) = 15
. |||
. ||+--- A116700(6) = 34 -> a(6) = 3
. ||
. |+--- A116700(3) = 23 -> a(3) = 2
. |
PROG
(Haskell)
import Data.List (isPrefixOf, find)
import Data.Maybe (fromJust)
a220376 n = a220376_list !! (n-1)
a220376_list = at 1 where
at z | (reverse (show (z - 1)) `isPrefixOf` fst bird) = at (z + 1)
| otherwise = (length $ fst bird) : at (z + 1)
where bird = fromJust $ find ((show z `isPrefixOf`) . snd) xys
xys = iterate (\(us, v : vs) -> (v : us, vs))
([], concatMap show [0 ..])
CROSSREFS
KEYWORD
AUTHOR
Reinhard Zumkeller, Dec 13 2012
STATUS
approved