OFFSET
0,2
LINKS
Reinhard Zumkeller, Table of n, a(n) for n = 0..10000
Éric Angelini, More fractal triangles (with primes), SeqFan list, Jan 12 2015.
EXAMPLE
. n : 0|1|2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|
. a(n): 1 2 3 4 6 2 8 9 3 4 5 7 6 2 8 11 13 9 3 4 5 10 12 7 6
. p/c : - p p c c p c c p c p p c p c p p c p c p c c p c
. : 1 _ _ _ _ 2 _ _ 3 4 _ _ 6 2 8 _ _ 9 3 4 5 _ _ 7 6 .
PROG
(Haskell)
a249900 n = a249900_list !! n
a249900_list = [1..4] ++ concatMap (uncurry (++))
(f [2] [3, 4] (drop 2 a000040_list) (tail a002808_list)) where
f us@(u:_) vs ps'@(p:p':ps) cs'@(c:c':cs)
| a010051 u == 1 = g ([c] ++ us ++ [c']) vs ps' cs
| otherwise = g ([p] ++ us ++ [p']) vs ps cs'
g us vs@(v:_) (p:ps) (c:cs) = (us, ws) : f us ws ps cs where
ws = if a010051 v == 1 then [c] ++ vs ++ [p] else [p] ++ vs ++ [c]
CROSSREFS
KEYWORD
nonn
AUTHOR
Eric Angelini and Reinhard Zumkeller, Jan 13 2015
STATUS
approved