cp's OEIS Frontend

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.

A124806 Number of circular n-letter words over the alphabet {0,1,2,3,4} with adjacent letters differing by at most 2.

This page as a plain text file.
%I A124806 #24 Apr 30 2025 14:08:32
%S A124806 1,5,19,65,247,955,3733,14649,57583,226505,891219,3507047,13801285,
%T A124806 54313277,213745019,841177105,3310392415,13027820227,51270096661,
%U A124806 201769982673,794052091767,3124938240153,12297982928987,48397879544975
%N A124806 Number of circular n-letter words over the alphabet {0,1,2,3,4} with adjacent letters differing by at most 2.
%C A124806 Empirical: a(base, n) = a(base-1, n) + A005191(n+1) for base >= 2*floor(n/2) + 1 where base is the number of letters in the alphabet.
%H A124806 G. C. Greubel, <a href="/A124806/b124806.txt">Table of n, a(n) for n = 0..1000</a>
%H A124806 OEIS Wiki, <a href="/wiki/Number_of_base_k_circular_n-digit_numbers_with_adjacent_digits_differing_by_d_or_less">Number of base k circular n-digit numbers with adjacent digits differing by d or less</a>
%H A124806 <a href="/index/Rec#order_05">Index entries for linear recurrences with constant coefficients</a>, signature (5,-3,-5,1,1).
%F A124806 From _Colin Barker_, Jun 04 2017: (Start)
%F A124806 G.f.: (1 - 3*x^2 - 10*x^3 + 3*x^4 + 4*x^5) / ((1 - x - x^2)*(1 - 4*x + x^3)).
%F A124806 a(n) = 5*a(n-1) - 3*a(n-2) - 5*a(n-3) + a(n-4) + a(n-5) for n>5. (End)
%F A124806 a(n) = -4*[n=0] + LucasL(n-1) + 3*A099503(n) - 8*A099503(n-1). - _G. C. Greubel_, Aug 03 2023
%t A124806 LinearRecurrence[{5,-3,-5,1,1}, {1,5,19,65,247,955}, 60] (* _G. C. Greubel_, Aug 03 2023 *)
%o A124806 (S/R) stvar $[N]:(0..M-1) init $[]:=0 asgn $[]->{*} kill +[i in 0..N-1](($[i]`-$[(i+1)mod N]`>2)+($[(i+1)mod N]`-$[i]`>2))
%o A124806 (Magma) R<x>:=PowerSeriesRing(Integers(), 30); Coefficients(R!( (1-3*x^2-10*x^3+3*x^4+4*x^5)/((1-x-x^2)*(1-4*x+x^3)) )); // _G. C. Greubel_, Aug 03 2023
%o A124806 (SageMath)
%o A124806 @CachedFunction
%o A124806 def a(n): # a = A124806
%o A124806     if (n<6): return (1,5,19,65,247,955)[n]
%o A124806     else: return 5*a(n-1)-3*a(n-2)-5*a(n-3)+a(n-4)+a(n-5)
%o A124806 [a(n) for n in range(31)] # _G. C. Greubel_, Aug 03 2023
%Y A124806 Cf. A000032, A005191, A099503, A124805, A124807.
%K A124806 nonn,easy
%O A124806 0,2
%A A124806 _R. H. Hardin_, Dec 28 2006