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 A227141 #24 Apr 02 2017 00:50:06 %S A227141 1,1,1,1,1,1,1,1,1,1,1,3,2,1,1,1,1,2,2,1,1,1,2,4,3,2,1,1,1,1,3,3,3,2, %T A227141 1,1,1,2,2,5,4,3,2,1,1,1,1,3,4,4,4,3,2,1,1,1,2,4,4,6,5,4,3,2,1,1,1,1, %U A227141 2,3,5,5,5,4,3,2,1,1,1,2,3,4,5,7,6,5,4,3,2,1,1 %N A227141 Array A(n,k) where A(1,k)=1 for row 1, and subsequent rows A(n > 1, k) are computed by recurrences related to Bulgarian Solitaire; square array A(n,k), with row n >= 1, column k >= 0, read by antidiagonals. %C A227141 The initial terms give the summands of the partitions (or: number of parts, when shifted once) that occur in the main trunk of Bulgarian solitaire tree computed for a pack containing 1+2+...+n cards. %C A227141 The irregular table A227147 gives just the palindromic subsequence from each row. After that part, the recurrence on row n always leads to a sequence of period n. %D A227141 Martin Gardner, Colossal Book of Mathematics, Chapter 34, Bulgarian Solitaire and Other Seemingly Endless Tasks, pp. 455-467, W. W. Norton & Company, 2001. %H A227141 Antti Karttunen, <a href="/A227141/b227141.txt">The first 99 antidiagonals of the table, flattened</a> %H A227141 Ethan Akin and Morton Davis, <a href="http://www.jstor.org/stable/2323643">"Bulgarian solitaire"</a>, American Mathematical Monthly 92 (4): 237-250. (1985). %F A227141 The recurrence for the r-th row of the table (after the first row, which contains a constant sequence A000012) is defined as follows: %F A227141 a_r(0) = 1; a_r(0<n<r) = n, a_r(n=r) = r-1, a_r(n=(r+1)) = n, a_r(n<2r) = r, and otherwise (for values n>=2r), a_r(n) = the least natural number k such that a_r(n-k-1) < k+1. %F A227141 See also the given Scheme program. %e A227141 The top left corner of the array begins %e A227141 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, ... %e A227141 1, 1, 1, 3, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, ... %e A227141 1, 1, 2, 2, 4, 3, 2, 3, 4, 2, 3, 3, 2, 3, 3, 2, 3, 3, 2, 3, 3, 2, ... %e A227141 1, 1, 2, 3, 3, 5, 4, 4, 3, 4, 5, 4, 3, 4, 4, 5, 3, 4, 4, 4, 3, 4, ... %e A227141 1, 1, 2, 3, 4, 4, 6, 5, 5, 5, 4, 5, 6, 5, 5, 4, 5, 5, 6, 5, 4, 5, ... %e A227141 ... %e A227141 For row 3, the recurrence manifests itself as: %e A227141 a_3(0) = 1; a_3(0<n<3) = n (i.e., a_3(1)=1, a_3(2)=2), a_3(3) = 2, a_3(4) = 4, a_3(4<n<6) (that is, a_3(5)) = 3, and after that, for values n>=6, a_3(n) = the least natural number k such that a_3(n-k-1) < k+1. %e A227141 As a_3(6-0-1) = a_3(5) = 3 is not less than 1, nor a_3(6-1-1) = a_3(4) = 2 is not less than 2, but a_3(6-2-1) = a_3(3) = 2 IS less than 3 (2+1), the sought value of k is 2, and a_3(6)=2. %o A227141 (Scheme, with _Antti Karttunen_'s IntSeq-library, using memoizing macros definec and implement-cached-function): %o A227141 (define (A227141 n) (A227141bi (+ 1 (A002262 n)) (A025581 n))) %o A227141 (define (A227141bi row col) ((rowfun-for-A227141 row) col)) %o A227141 (definec (rowfun-for-A227141 n) (if (< n 2) (lambda (k) n) (implement-cached-function 0 (rowfun-n k) (cond ((zero? k) 1) ((< k n) k) ((= k n) (- n 1)) ((= k (+ n 1)) k) ((< k (* 2 n)) n) (else (let loop ((i 1)) (if (< (rowfun-n (- k i)) i) (- i 1) (loop (+ i 1))))))))) %Y A227141 Cf. A227147. %K A227141 nonn,tabl %O A227141 0,12 %A A227141 _Antti Karttunen_, Jul 03 2013