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-3 of 3 results.

A185265 a(0)=1, a(1)=2; thereafter a(n) = f(n-1) + f(n-2) where f() = A164387().

Original entry on oeis.org

1, 2, 3, 6, 12, 22, 39, 70, 127, 231, 419, 759, 1375, 2492, 4517, 8187, 14838, 26892, 48739, 88335, 160099, 290164, 525894, 953132, 1727460, 3130855, 5674373, 10284254, 18639219, 33781788, 61226235, 110966650, 201116358, 364504015, 660628396, 1197325296, 2170036700, 3932982369, 7128151480
Offset: 0

Views

Author

N. J. A. Sloane, Mar 31 2011

Keywords

Comments

Arises in studying lunar arithmetic.

Crossrefs

Programs

  • Mathematica
    CoefficientList[Series[-(x + 1)*(x^4 + x^3 + 1)/(x^5 + x^4 + x^2 + x - 1), {x, 0, 50}], x] (* G. C. Greubel, Jun 25 2017 *)
  • PARI
    x='x+O('x^50); Vec(-(x+1)*(x^4+x^3+1)/(x^5+x^4+x^2+x-1)) \\ G. C. Greubel, Jun 25 2017

Formula

Satisfies the same recurrence as A164387 and A079976, although with different initial conditions.
From Colin Barker, Jul 25 2013: (Start)
a(n) = a(n-1) + a(n-2) + a(n-4) + a(n-5) for n>5.
G.f.: -(x+1)*(x^4+x^3+1) / (x^5+x^4+x^2+x-1). (End)

A209400 Number of subsets of {1,...,n} containing a subset of the form {k,k+1,k+3} for some k.

Original entry on oeis.org

0, 0, 0, 0, 2, 7, 19, 46, 107, 242, 535, 1162, 2490, 5281, 11108, 23206, 48206, 99663, 205218, 421115, 861585, 1758249, 3580075, 7275377, 14759592, 29897683, 60481359, 122206014, 246665382, 497414751, 1002231335, 2017877779, 4060069150, 8164204342
Offset: 0

Views

Author

David Nacin, Mar 07 2012

Keywords

Comments

Also, number of subsets of {1,...,n} containing {a,a+2,a+3} for some a.
Also, number of bitstrings of length n containing 1101 or 1111.

Examples

			When n=4 the only subsets containing an {a,a+1,a+3} happen when a=1 with the two subsets {1,2,3,4} and {1,2,4}.  Thus a(4)=2.
		

Crossrefs

Programs

  • Magma
    I:=[0, 0, 0, 0, 2, 7]; [n le 6 select I[n] else 3*Self(n-1) - Self(n-2)-2*Self(n-3)+Self(n-4)-Self(n-5)-2*Self(n-6): n in [0..30]]; // G. C. Greubel, Jan 03 2018
  • Mathematica
    LinearRecurrence[{3, -1, -2, 1, -1, -2}, {0, 0, 0, 0, 2, 7}, 40]
    CoefficientList[Series[x^4*(2+x)/(1-3*x+x^2+2*x^3-x^4+x^5+2*x^6), {x,0, 50}], x] (* G. C. Greubel, Jan 03 2018 *)
  • PARI
    x='x+O('x^30); concat([0,0,0,0], Vec(x^4*(2+x)/(1-3*x+x^2+2*x^3-x^4+x^5+2*x^6))) \\ G. C. Greubel, Jan 03 2018
    
  • Python
    #From recurrence
    def a(n, adict={0:0, 1:0, 2:0, 3:0, 4:2, 5:7}):
     if n in adict:
      return adict[n]
     adict[n]=3*a(n-1)-a(n-2)-2*a(n-3)+a(n-4)-a(n-5)-2*a(n-6)
     return adict[n]
    
  • Python
    #Returns the actual list of valid subsets
    def contains1101(n):
     patterns=list()
     for start in range (1,n-2):
      s=set()
      for i in range(4):
       if (1,1,0,1)[i]:
        s.add(start+i)
      patterns.append(s)
     s=list()
     for i in range(2,n+1):
      for temptuple in comb(range(1,n+1),i):
       tempset=set(temptuple)
       for sub in patterns:
        if sub <= tempset:
         s.append(tempset)
         break
     return s
    #Counts all such sets
    def countcontains1101(n):
     return len(contains1101(n))
    

Formula

a(n) = 3*a(n-1) - a(n-2) - 2*a(n-3) + a(n-4) - a(n-5) - 2*a(n-6), a(4)=2, a(5)=7, a(i)=0 for i<4.
G.f.: x^4*(2 + x)/(1 - 3*x + x^2 + 2*x^3 - x^4 + x^5 + 2*x^6) = x^4*(2 + x)/((1 - 2*x)*(1 - x - x^2 - x^4 - x^5)).
a(n) = 2^n - A164387(n).

A188765 Number of binary strings of length n with no substrings equal to 00000 or 00100.

Original entry on oeis.org

1, 2, 4, 8, 16, 30, 57, 108, 207, 397, 761, 1456, 2784, 5324, 10185, 19488, 37288, 71341, 136486, 261117, 499561, 955756, 1828549, 3498364, 6693021, 12804983, 24498304, 46869822, 89670729, 171556853, 328220258, 627946528, 1201378750, 2298461537, 4397385531, 8413018547, 16095673253, 30794024151, 58914710037, 112714825621, 215644478604, 412568097507, 789319699503, 1510115764260
Offset: 0

Views

Author

N. J. A. Sloane, Apr 09 2011

Keywords

Comments

Thanks to Michael Somos for telling me about Mathematica's SatisfiabilityCount command.
Thanks to Doron Zeilberger for telling me about the Noonan-Zeilberger GJs command.

Examples

			1 + 2*x + 4*x^2 + 8*x^3 + 16*x^4 + 30*x^5 + 57*x^6 + 108*x^7 + 207*x^8 + ...
		

Crossrefs

Cf. A164387.

Programs

  • Maple
    # First download the Maple package DAVID_IAN from the Zeilberger web site
    read(DAVID_IAN);
    GJs({0,1},{[0,0,0,0,0],[0,0,1,0,0]},x);
  • Mathematica
    a[ n_] := If[ n<0, 0, Length @ Cases[ Tuples[ {0, 1}, n], Except @ {_, 0, 0, , 0, 0, __}]] (* Michael Somos, Apr 10 2011 *)
    SPAN = 5; MMM = 60;
    For[ M=SPAN, M <= MMM, M++,
    vlist = Array[x, M];
    cl[i_] := Or[ x[i], x[i+1], x[i+3], x[i+4] ];
    cl2 = True; For [ i=1, i <= M-SPAN+1, i++, cl2 = And[cl2, cl[i]] ];
    R[M] = SatisfiabilityCount[ cl2, vlist ] ]
    Table[ R[M], {M,SPAN,MMM}] (* N. J. A. Sloane *)
    CoefficientList[Series[(1 + x + x^2 + 2 x^3 + 3 x^4 + 2 x^5 + x^6)/(1 - x - x^2 - x^4 - 2 x^5 - 2 x^6 - x^7), {x, 0, 50}], x] (* Vincenzo Librandi, Dec 09 2012 *)
  • PARI
    {a(n) = local(m, k); if( n<0, 0, forvec( v = vector( n, i, [0, 1]), k=0; for( i = 1, n-4, if( [v[i], v[i+1], v[i+3], v[i+4]] == [0, 0, 0, 0], k=1; break)); if( !k, m++)); m)} /* Michael Somos, Apr 09 2011 */

Formula

G.f.: (1 + x + x^2 + 2*x^3 + 3*x^4 + 2*x^5 + x^6) / (1 - x - x^2 - x^4 - 2*x^5 - 2*x^6 - x^7).
Showing 1-3 of 3 results.