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.

Showing 1-4 of 4 results.

A006156 Number of ternary squarefree words of length n.

Original entry on oeis.org

1, 3, 6, 12, 18, 30, 42, 60, 78, 108, 144, 204, 264, 342, 456, 618, 798, 1044, 1392, 1830, 2388, 3180, 4146, 5418, 7032, 9198, 11892, 15486, 20220, 26424, 34422, 44862, 58446, 76122, 99276, 129516, 168546, 219516, 285750, 372204, 484446, 630666, 821154
Offset: 0

Views

Author

Keywords

Comments

a(n), n > 0, is a multiple of 3 by symmetry. - Michael S. Branicky, Jul 21 2021

Examples

			Let the alphabet be {a,b,c}. Then:
a(1)=3: a, b, c.
a(2)=6: all xy except aa, bb, cc.
a(3)=12: aba, abc, aca, acb and similar words beginning with b and c, for a total of 12.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Second column of A215075, multiplied by 3!=6.

Programs

  • Mathematica
    (* A simple solution (though not at all efficient beyond n = 12) : *) a[0] = 1; a[n_] := a[n] = Length @ DeleteCases[Tuples[Range[3], n] , {a___, b__, b__, c___} ]; s = {}; Do[Print["a[", n, "] = ", a[n]]; AppendTo[s, a[n]], {n, 0, 12}]; s (* Jean-François Alcover, May 02 2011 *)
    Length/@NestList[DeleteCases[Flatten[Outer[Append, #, Range@3, 1], 1], {_, x__, x__, _}] &, {{}}, 20] (* Vladimir Reshetnikov, May 16 2016 *)
  • Python
    def isf(s): # incrementally squarefree (check factors ending in last letter)
        for l in range(1, len(s)//2 + 1):
            if s[-2*l:-l] == s[-l:]: return False
        return True
    def aupton(nn, verbose=False):
        alst, sfs = [1], set("0")
        for n in range(1, nn+1):
            an = 3*len(sfs)
            sfsnew = set(s+i for s in sfs for i in "012" if isf(s+i))
            alst, sfs = alst+[an], sfsnew
            if verbose: print(n, an)
        return alst
    print(aupton(40)) # Michael S. Branicky, Jul 21 2021

Formula

a(n) >= 2^(n/17), see Zeilberger. Let L = lim_{n->infinity} a(n)^(1/n); then L exists and Grimm proves 1.109999 < L < 1.317278. - Charles R Greathouse IV, Nov 29 2013
L exists since a(n) is submultiplicative; 1.3017597 < L < 1.3017619 (Shur 2012); the gap between the bounds can be made less than any given constant. - Arseny Shur, Apr 22 2015

Extensions

Links corrected by Eric Rowland, Sep 16 2010

A215075 T(n,k) = Number of squarefree words of length n in a (k+1)-ary alphabet, with new values 0..k introduced in increasing order.

Original entry on oeis.org

1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 2, 3, 0, 1, 1, 2, 4, 5, 0, 1, 1, 2, 4, 11, 7, 0, 1, 1, 2, 4, 12, 29, 10, 0, 1, 1, 2, 4, 12, 39, 77, 13, 0, 1, 1, 2, 4, 12, 40, 138, 202, 18, 0, 1, 1, 2, 4, 12, 40, 153, 503, 532, 24, 0, 1, 1, 2, 4, 12, 40, 154, 638, 1864, 1395, 34, 0, 1, 1, 2, 4, 12, 40, 154, 659
Offset: 1

Views

Author

R. H. Hardin, Aug 02 2012

Keywords

Comments

Alternative definition: for (k+1)-ary words u=u_1...u_n and v=v_1...v_n, let u~v if there exists a permutation t of the alphabet such that v_i=t(u_i), i=1,...,n. Then ~ preserves length and squarefreeness, and T(n,k) is the number of equivalence classes of (k+1)-ary squarefree words of length n. - Arseny Shur, Apr 26 2015

Examples

			Table starts
.1..1....1.....1......1......1......1......1......1......1......1......1......1
.1..1....1.....1......1......1......1......1......1......1......1......1......1
.1..2....2.....2......2......2......2......2......2......2......2......2......2
.0..3....4.....4......4......4......4......4......4......4......4......4......4
.0..5...11....12.....12.....12.....12.....12.....12.....12.....12.....12.....12
.0..7...29....39.....40.....40.....40.....40.....40.....40.....40.....40.....40
.0.10...77...138....153....154....154....154....154....154....154....154....154
.0.13..202...503....638....659....660....660....660....660....660....660....660
.0.18..532..1864...2825...3085...3113...3114...3114...3114...3114...3114...3114
.0.24.1395..6936..12938..15438..15893..15929..15930..15930..15930..15930..15930
.0.34.3664.25868..60458..81200..86857..87599..87644..87645..87645..87645..87645
.0.44.9605.96512.285664.442206.502092.513649.514795.514850.514851.514851.514851
...
Some solutions for n=6 k=4
..0....0....0....0....0....0....0....0....0....0....0....0....0....0....0....0
..1....1....1....1....1....1....1....1....1....1....1....1....1....1....1....1
..2....2....2....2....2....2....2....2....2....2....0....2....2....2....0....2
..3....3....0....0....1....3....0....3....1....0....2....3....3....3....2....1
..1....2....3....3....0....0....3....1....3....2....1....4....1....4....0....0
..0....0....1....0....3....3....2....3....1....1....2....1....2....0....1....2
		

Crossrefs

Column 2 is A060688(n-1), or A006156 divided by 6 (for n>1).
Column 3 is A118311, or A051041 divided by 24 (for n>3).

Formula

From Arseny Shur, Apr 26 2015: (Start)
Let L_k be the limit lim T(n,k)^{1/n}, which exists because T(n,k) is a submultiplicative sequence for any k. Then L_k=k-1/k-1/k^3-O(1/k^5) (Shur, 2010).
Exact values of L_k for small k, rounded up to several decimal places:
L_2=1.30176..., L_3=2.6215080..., L_4=3.7325386... (for L_5,...,L_14 see Shur arXiv:1009.4415).
Empirical observation: for k=2 the O-term in the general formula is slightly bigger than 2/k^5, and for k=3,...,14 this O-term is slightly smaller than 2/k^5.
(End)

A118311 Number of dissimilar squarefree quaternary words of length n.

Original entry on oeis.org

1, 1, 2, 4, 11, 29, 77, 202, 532, 1395, 3664, 9605, 25192, 66047, 173183, 453998, 1190259, 3120294, 8180124, 21444290, 56217025, 147373441, 386342414, 1012799936, 2655067412, 6960281083, 18246444362, 47833200849, 125395149294, 328724391241, 861753701567, 2259094233704
Offset: 1

Views

Author

Alford Arnold, Apr 22 2006

Keywords

Comments

Sherman Stein and A006156 count ordered squarefree(twin-free) ternary words. A060688 counts the dissimilar cases essentially by dividing by 3! (the number of ways to permute a,b,c). A051041 counts ordered squarefree quaternary words. A118311 counts the dissimilar cases (beginning with the 4th term) by dividing A051041 by 4!.

Examples

			a(1) = 1 because a,b,c and d are similar.
a(2) = 1 because aa is not squarefree; so ab is the only valid case.
a(3) = 2 counting aba and abc.
a(4) = 4 counting abac, abca, abcb and abcd.
a(5) = 11 counting abaca,abacb,abcab,abcac,abcba,abacd,abcad,abcbd,abcda,abcdb and abcdc.
		

References

  • Sherman Stein, How The Other Half Thinks, 2001, page 149.

Crossrefs

Extensions

a(16)-a(25) from Max Alekseyev, Jul 03 2006
a(26)-a(30) from Giovanni Resta, Mar 20 2020

A177736 Partial sums of A006156.

Original entry on oeis.org

1, 4, 10, 22, 40, 70, 112, 172, 250, 358, 502, 706, 970, 1312, 1768, 2386, 3184, 4228, 5620, 7450, 9838, 13018, 17164, 22582, 29614, 38812, 50704, 66190, 86410, 112834, 147256, 192118, 250564, 326686, 425962, 555478, 724024, 943540, 1229290
Offset: 0

Views

Author

Jonathan Vos Post, May 12 2010

Keywords

Comments

Partial sums of number of ternary squarefree words of length n. Is this always even after a(0) = 1? If so, there are no prime elements, and the subsequence of semiprime elements begins: 358, 502, 706, 2386, 9838, 112834, 192118, 425962. As Weisstein writes in the Mathworld link from A006156: A "square" word consists of two identical adjacent subwords (for example, acbacb). A squarefree word contains no square words as subwords (for example, abcacbabcb). The only squarefree binary words are a, b, ab, ba, aba, and bab (since aa, bb, aaa, aab, abb, baa, bba, and bbb contain square identical adjacent subwords a, b, a, a, b, a, b, and b, respectively). However, there are arbitrarily long ternary squarefree words.

Crossrefs

Formula

a(n) = Sum_{i=0..n} A006156(i).
Showing 1-4 of 4 results.