OFFSET
0,2
COMMENTS
7 divides a(n) for all n.
lim n -> infinity a(n)/7^n ~ 0.697286015491013 is the probability that a random, infinite string over a 7-letter alphabet does not begin with a palindrome.
This sequence gives the number of walks on K_7 with loops that do not begin with a palindromic sequence.
LINKS
Peter Kagey, Table of n, a(n) for n = 0..1000
FORMULA
a(n) = 7^n - A249640(n) for n > 0.
EXAMPLE
For n = 3, the first 10 of the a(3) = 252 solutions are (in lexicographic order) 011, 012, 013, 014, 015, 016, 021, 022, 023, 024.
MATHEMATICA
a252700[n_] := Block[{f}, f[0] = f[1] = 0;
f[x_] := 7*f[x - 1] + 7^Ceiling[(x)/2] - f[Ceiling[(x)/2]];
Prepend[Rest@Table[7^i - f[i], {i, 0, n}], 0]]; a252700[21] (* Michael De Vlieger, Dec 26 2014 *)
PROG
(Ruby) seq = [1, 0]; (2..N).each { |i| seq << 7 * seq[i-1] + 7**((i+1)/2) - seq[(i+1)/2] }; seq = seq.each_with_index.collect { |a, i| 7**i - a }
CROSSREFS
KEYWORD
easy,nonn,walk
AUTHOR
Peter Kagey, Dec 20 2014
STATUS
approved