A252697 Number of strings of length n over a 4-letter alphabet that do not begin with a palindrome.
0, 4, 12, 36, 132, 492, 1932, 7596, 30252, 120516, 481572, 1924356, 7695492, 30774372, 123089892, 492329316, 1969287012, 7877027532, 31507989612, 126031476876, 504125425932, 2016499779372, 8065997193132, 32263981077036, 129055916612652, 516223635676236
Offset: 0
Examples
For n = 3, the first 10 of the a(3) = 36 solutions are (in lexicographic order) 011, 012, 013, 021, 022, 023, 031, 032, 033, 100.
Links
- Peter Kagey, Table of n, a(n) for n = 0..1000
Crossrefs
Programs
-
Ruby
seq = [1, 0]; (2..N).each { |i| seq << 4 * seq[i-1] + 4**((i+1)/2) - seq[(i+1)/2] }; seq = seq.each_with_index.collect { |a, i| 4**i - a }
Formula
a(n) = 4^n - A249629(n) for n > 0.
Comments