login
A249900
Sequence which reappears when consecutive terms are erased iff they both are either prime or nonprime.
2
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, 2, 8, 11, 14, 15, 13, 9, 3, 4, 5, 10, 17, 19, 12, 7, 6, 2, 8, 11, 14, 23, 29, 15, 13, 9, 3, 4, 5, 10, 17, 16, 18, 19, 12, 7, 6, 2, 8, 11, 14, 23, 20, 21, 29, 15, 13, 9, 3, 4, 5
OFFSET
0,2
LINKS
É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
STATUS
approved