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 A287898 #56 Jun 03 2017 07:27:42 %S A287898 1,3,9,27,79,233,687,2025,5969,17595,51865,152883,450655,1328401, %T A287898 3915743,11542481,34023905,100292659,295633833,871443275,2568763439, %U A287898 7571973753,22319994767,65792907193,193938514865,571674807403,1685132453689,4967284459107 %N A287898 Number of ways to go up and down n stairs, with fewer than 4 stairs at a time, stepping on each stair at least once. %C A287898 Also the number of words using 0, 1 and 2 which have n-1 length and don't appear 0000 or 1111. %H A287898 Colin Barker, <a href="/A287898/b287898.txt">Table of n, a(n) for n = 1..1000</a> %H A287898 <a href="/index/Rec#order_04">Index entries for linear recurrences with constant coefficients</a>, signature (2,2,2,1). %F A287898 a(n+4) = 2*a(n+3) + 2*a(n+2) + 2*a(n+1) + a(n). %F A287898 G.f.: x*(1 + x)*(1 + x^2) / (1 - 2*x - 2*x^2 - 2*x^3 - x^4). - _Colin Barker_, Jun 02 2017 %e A287898 n = 2 %e A287898 0->1->2->0 (0), 0->2->1->0 (1), 0->1->2->1->0 (2). So a(2) = 3. %e A287898 n = 3 %e A287898 0->1->2->3->0 (00), 0->1->3->2->0 (01), 0->1->2->3->2->0 (02), %e A287898 0->2->3->1->0 (10), 0->3->2->1->0 (11), 0->2->3->2->1->0 (12), %e A287898 0->1->2->3->1->0 (20), 0->1->3->2->1->0 (21), 0->1->2->3->2->1->0 (22). So a(3) = 9. %e A287898 ... %e A287898 n = 5 %e A287898 0->1->2->3->5->4->0 (0001), ... , 0->4->5->3->2->1->0 (1110), %e A287898 0->4->5->4->3->2->1->0 (1112), ... , 0->1->2->3->4->5->4->3->2->1->0 (2222). %e A287898 So a(5) = 81 - 2 = 79. %t A287898 CoefficientList[Series[(1 + x)*(1 + x^2)/(1 - 2*x - 2*x^2 - 2*x^3 - x^4), {x, 0, 30}], x] (* _Wesley Ivan Hurt_, Jun 02 2017 *) %o A287898 (Ruby) %o A287898 def f(ary, n) %o A287898 return false if ary.size < n %o A287898 a = ary[-1] %o A287898 ary[-n..-2].all?{|i| i == a} %o A287898 end %o A287898 def A(k, n) %o A287898 f_ary = [[]] %o A287898 ary = [1] %o A287898 (n - 1).times{ %o A287898 b_ary = [] %o A287898 f_ary.each{|i| %o A287898 i0, i1, i2 = i + [0], i + [1], i + [2] %o A287898 b_ary << i0 if !f(i0, k) %o A287898 b_ary << i1 if !f(i1, k) %o A287898 b_ary << i2 %o A287898 } %o A287898 f_ary = b_ary %o A287898 ary << f_ary.size %o A287898 } %o A287898 ary %o A287898 end %o A287898 p A(4, 10) %o A287898 (PARI) Vec(x*(1 + x)*(1 + x^2) / (1 - 2*x - 2*x^2 - 2*x^3 - x^4) + O(x^30)) \\ _Colin Barker_, Jun 02 2017 %Y A287898 Cf. A001333, A233828(n-1). %K A287898 nonn,easy %O A287898 1,2 %A A287898 _Seiichi Manyama_, Jun 02 2017 %E A287898 More terms from _Colin Barker_, Jun 02 2017