This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A244315 #10 Jul 05 2014 14:11:31 %S A244315 0,0,1,0,0,2,0,1,0,0,1,0,0,2,3,0,1,0,0,2,0,1,0,0,1,0,0,2,0,1,0,0,1,0, %T A244315 0,2,3,0,1,0,0,2,4,0,1,0,0,2,0,1,0,0,1,0,0,2,3,0,1,0,0,2,0,1,0,0,1,0, %U A244315 0,2,0,1,0,0,1,0,0,2,3,0,1,0,0,2,0,1,0,0,1,0,0,2,0,1,0,0,1,0,0,2,3,0,1,0,0,2,4,0,1,0,0,2,0,1,0,0,1,0,0,2,3,0,1,0,0,2,0,1,0,0,1,0,5 %N A244315 a(0) = 0, after which, if A176137(n) = 1, a(n) = A007814(A244230(n)), otherwise a(n) = a(n-A197433(A244230(n)-1)). %C A244315 For n >= 1, a(n) tells the zero-based position of the digit (from the right) where the iteration stopped at, when constructing a Semigreedy Catalan representation of n as described in A244159. %H A244315 Antti Karttunen, <a href="/A244315/b244315.txt">Table of n, a(n) for n = 0..4862</a> %F A244315 a(0) = 0, and for n >= 1, if A176137(n) = 1, a(n) = A007814(A244230(n)), otherwise a(n) = a(n-A197433(A244230(n)-1)). %o A244315 (Scheme, two alternative versions) %o A244315 ;; This version is based on the given recurrence and uses memoizing definec-macro from _Antti Karttunen_'s IntSeq-library: %o A244315 (definec (A244315 n) (cond ((zero? n) n) ((not (zero? (A176137 n))) (A007814 (A244230 n))) (else (A244315 (- n (A197433 (-1+ (A244230 n)))))))) %o A244315 (define (A244315 n) (let outer_loop ((n n)) (let inner_loop ((n n) (i (A244160 n))) (cond ((zero? n) i) ((zero? i) (outer_loop n)) ((<= (A000108 i) n) (inner_loop (- n (A000108 i)) (- i 1))) (else (inner_loop n (- i 1))))))) %Y A244315 One less than A244316. %Y A244315 Cf. A000108, A007814, A176137, A197433, A244230, A244159. %K A244315 nonn %O A244315 0,6 %A A244315 _Antti Karttunen_, Jun 25 2014