login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A249641 Number of strings of length n over an 8-letter alphabet that begin with a nontrivial palindrome. 10

%I #23 Dec 28 2014 22:46:35

%S 0,0,8,120,1016,8520,68552,551496,4415048,35344632,282781304,

%T 2262444024,18099745784,144799511928,1158397641080,9267193490808,

%U 74137560288632,593100581182152,4744804748330312,37958438777603016,303667511011784648,2429340094421767752

%N Number of strings of length n over an 8-letter alphabet that begin with a nontrivial palindrome.

%C A nontrivial palindrome is a palindrome of length 2 or greater. (E.g., "1" is a trivial palindrome, but "11" and "121" are nontrivial palindromes.)

%C For example, 0072 is a string of length 4 over an eight letter alphabet that begins with a nontrivial palindrome (00).

%C 8 divides a(n) for all n.

%C a(n) is the number of distinct walks of n steps that begin with a palindromic sequence on the complete graph K_8 with loops. (E.g., 0, 1, 1, 0, 4, 1, 2 is a valid walk with 7 steps and begins with the palindromic sequence '0110'.)

%C lim n -> infinity a(n)/8^n ~ 0.2633895810038296 is the probability that a random, infinite base-8 string begins with a nontrivial palindrome.

%H Peter Kagey, <a href="/A249641/b249641.txt">Table of n, a(n) for n = 0..1000</a>

%F a(0) = 0; a(1) = 0; a(n+1) = 8*a(n) + 8^ceiling((n+1)/2) - a(ceiling((n+1)/2)).

%e For n=3 the a(3) = 120 valid strings are: 000, 001, 002, 003, 004, 005, 006, 007, 010, 020, 030, 040, 050, 060, 070, 101, 110, 111, 112, 113, 114, 115, 116, 117, 121, 131, 141, 151, 161, 171, 202, 212, 220, 221, 222, 223, 224, 225, 226, 227, 232, 242, 252, 262, 272, 303, 313, 323, 330, 331, 332, 333, 334, 335, 336, 337, 343, 353, 363, 373, 404, 414, 424, 434, 440, 441, 442, 443, 444, 445, 446, 447, 454, 464, 474, 505, 515, 525, 535, 545, 550, 551, 552, 553, 554, 555, 556, 557, 565, 575, 606, 616, 626, 636, 646, 656, 660, 661, 662, 663, 664, 665, 666, 667, 676, 707, 717, 727, 737, 747, 757, 767, 770, 771, 772, 773, 774, 775, 776, 777

%t a249641[n_] := Block[{f},

%t f[0] = f[1] = 0;

%t f[x_] := 8*f[x - 1] + 8^Ceiling[x/2] - f[Ceiling[x/2]];

%t Table[f[i], {i, 0, n}]]; a249641[20] (* _Michael De Vlieger_, Dec 27 2014 *)

%o (Ruby) seq = [0, 0]; (2..N).each{ |i| seq << 8 * seq[i-1] + 8**((i+1)/2) - seq[(i+1)/2] }

%Y Analogous sequences for k-letter alphabets: A248122 (k=3), A249629 (k=4), A249638 (k=5), A249639 (k=6), A249640 (k=7), A249642 (k=9), A249643(k=10).

%K easy,nonn,walk

%O 0,3

%A _Peter Kagey_, Nov 02 2014

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 23 15:20 EDT 2024. Contains 371916 sequences. (Running on oeis4.)