OFFSET
1,4
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..31739, up to the stage S(15)
EXAMPLE
S(1) = {1}.
S(2) = {1,1,1}, because a(1) = 1, which is odd.
S(3) = {1,1,1,2,1,1,1}, because a(2) = 1, which is odd.
S(4) = {1,1,1,2,1,1,1,3,1,1,1,2,1,1,1}.
S(5) = {1,1,1,2,1,1,1,3,1,1,1,2,1,1,1,1,1,1,2,1,1,1,3,1,1,1,2,1,1,1}, because a(4) = 2, which is even.
Etc.
MATHEMATICA
Fold[Flatten@ Join[#1, If[OddQ[#1[[#2]]], {#2}, {}], #1] &, {1}, Range@ 6] (* Michael De Vlieger, Oct 18 2017 *)
PROG
(Scheme, with memoization-macro definec)
(definec (A137844 n) (if (= 1 n) n (let ((k (let loop ((j 1)) (if (>= (A291754 j) n) j (loop (+ 1 j)))))) (cond ((= (+ 1 (A291754 (- k 1))) n) (if (odd? (A137844 (- k 1))) (- k 1) 1)) (else (A137844 (- n (+ (A291754 (- k 1)) (A000035 (A137844 (- k 1)))))))))))
(define (A000035 n) (modulo n 2))
;; Antti Karttunen, Aug 31 2017
CROSSREFS
KEYWORD
easy,nonn
AUTHOR
Leroy Quet, Feb 13 2008
EXTENSIONS
Data section filled up to the length of stage S(7) by Antti Karttunen, Aug 31 2017
STATUS
approved