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.

User: Daniel T. Martin

Daniel T. Martin's wiki page.

Daniel T. Martin has authored 2 sequences.

A363256 Number of length n strings on the alphabet {0,1,2,3} with digit sum at most 4.

Original entry on oeis.org

1, 4, 13, 32, 66, 121, 204, 323, 487, 706, 991, 1354, 1808, 2367, 3046, 3861, 4829, 5968, 7297, 8836, 10606, 12629, 14928, 17527, 20451, 23726, 27379, 31438, 35932, 40891, 46346, 52329, 58873, 66012, 73781, 82216, 91354, 101233, 111892, 123371, 135711
Offset: 0

Author

Daniel T. Martin, May 23 2023

Keywords

Examples

			For n=2, the 13 strings are all possible 2-character strings of '0', '1', '2' and '3' except the four strings '33', '32', '23'.
		

Crossrefs

Cf. A227259 (the same for {0,1,2} with digit sum <= 4).
Cf. A105163 (the same for {0,1,2} with digit sum <= 3, shifted by 2).
Cf. A005718.

Programs

  • Mathematica
    f[n_, r_, l_] := If[r < 0, 0, If[r==0, 1, If[l < 0, 0, If[l == 0, 1, Sum[f[n, r-j, l-1], {j, 0, n}]]]]]; Table[f[3, 4,x], {x, 0, 40}]

Formula

a(n) = (((n + 10)*n + 35)*n + 26)*n/24 + 1.
G.f.: -(x^4 - 3*x^3 + 3*x^2 - x + 1)/(x - 1)^5.
a(n) = 1 + A005718(n-1) for n>=1.

A282087 Number of length-n ternary strings that do not contain both "00" and "11".

Original entry on oeis.org

1, 3, 9, 27, 79, 229, 657, 1871, 5295, 14909, 41801, 116783, 325287, 903741, 2505377, 6932479, 19151519, 52833853, 145578265, 400705135, 1101936119, 3027902045, 8314284721, 22816209855, 62579270191, 171559358493, 470132335209, 1287861941487, 3526800739399
Offset: 0

Author

Daniel T. Martin, Feb 05 2017

Keywords

Examples

			for n=5 the 229 acceptable ternary strings are all length 5 strings of '0', '1', and '2' _except_ '00011', '00110', '00111', '00112', '00211', '01100', '10011', '11000', '11001', '11002', '11100', '11200', '20011', '21100'.
		

Crossrefs

Cf. A078057 (number of length-n ternary strings that contain neither "00" nor "11").

Programs

  • Mathematica
    Table[3^n, {n, 0, 3}]~Join~LinearRecurrence[{4, -1, -6, -2}, {79, 229, 657, 1871}, 24] (* or *)
    Table[Count[Tuples[Range[0, 2], n], w_ /; Boole[SequenceCount[w, {0, 0}] > 0] Boole[SequenceCount[w, {1, 1}] > 0] == 0], {n, 0, 12}] (* Michael De Vlieger, Feb 05 2017, latter program version 10.1 *)
  • PARI
    a(n)=([0,1,0,0;0,0,1,0;0,0,0,1;-2,-6,-1,4]^n*[1;3;9;27])[1,1] \\ Charles R Greathouse IV, Feb 05 2017
    
  • PARI
    Vec((1 + x)*(1 - 2*x) / ((1 - 2*x - x^2)*(1 - 2*x - 2*x^2)) + O(x^30)) \\ Colin Barker, Feb 07 2017
  • Python
    import itertools
    # Not feasible on most machines for large numbers
    def find_a_sub_n(n):
        c = 0
        for q in itertools.product(*([['0','1','2']]*n)):
            h = ''.join(q)
            if not (('11' in h) and ('00' in h)):
                c = c+1
        return c
    

Formula

a(n) = 4*a(n-1) - a(n-2) - 6*a(n-3) - 2*a(n-4) for n >= 4 (derived in the math.stackexchange.com link).
From Colin Barker, Feb 07 2017: (Start)
a(n) = -(1-u)^(1+n)/2 - (1+u)^(1+n)/2 + (1-v)^n - (2*(1-v)^n)/v + (1+v)^n + (2*(1+v)^n) / v where u=sqrt(2) and v=sqrt(3).
G.f.: (1 + x)*(1 - 2*x) / ((1 - 2*x - x^2)*(1 - 2*x - 2*x^2)).
(End)