A252698 Number of strings of length n over a 5-letter alphabet that do not begin with a palindrome.
0, 5, 20, 80, 380, 1820, 9020, 44720, 223220, 1114280, 5569580, 27838880, 139185380, 695882180, 3479366180, 17396607680, 86982815180, 434912961620, 2174563693820, 10872812899520, 54364058928020, 271820266801220, 1359101306167220, 6795506391650720
Offset: 0
Examples
For n = 3, the first 10 of the a(3) = 80 solutions are (in lexicographic order) 011, 012, 013, 014, 021, 022, 023, 024, 031, 032.
Links
- Peter Kagey, Table of n, a(n) for n = 0..1000
Crossrefs
Programs
-
Ruby
seq = [1, 0]; (2..N).each { |i| seq << 5 * seq[i-1] + 5**((i+1)/2) - seq[(i+1)/2] }; seq = seq.each_with_index.collect { |a, i| 5**i - a }
Formula
a(n) = 5^n - A249638(n) for n > 0.
Comments