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.

A209410 Number of subsets of {1,...,n} not containing {a,a+2,a+4} for any a.

This page as a plain text file.
%I A209410 #16 May 22 2025 10:21:35
%S A209410 1,2,4,8,16,28,49,91,169,312,576,1056,1936,3564,6561,12069,22201,
%T A209410 40826,75076,138096,254016,467208,859329,1580535,2907025,5346880,
%U A209410 9834496,18088448,33269824,61192712,112550881,207013417,380757169,700321570,1288092100
%N A209410 Number of subsets of {1,...,n} not containing {a,a+2,a+4} for any a.
%C A209410 Also, the number of bitstrings of length n not containing 10101,11101,10111 or 11111.
%H A209410 G. C. Greubel, <a href="/A209410/b209410.txt">Table of n, a(n) for n = 0..1000</a>
%H A209410 <a href="/index/Rec#order_09">Index entries for linear recurrences with constant coefficients</a>, signature (1, 0, 2, 0, 2, 2, 0, -1, -1).
%F A209410 a(n) = 2^n - A209409(n).
%F A209410 a(n) = t[floor(n/2)+2]*t[floor((n+1)/2)+2] where t(n) is the n-th tribonacci number.
%F A209410 a(n) = a(n-1) + 2*a(n-3) + 2*a(n-5) + 2*a(n-6) - a(n-8) - a(n-9).
%F A209410 G.f.: (1 + 1*x + 2*x^2 + 2*x^3 + 4*x^4 + 2*x^5 - 1*x^6 - 2*x^7 - x^8)/((-1 + x + x^2 + x^3)*(-1 - x^2 - x^4 + x^6)).
%e A209410 For n=5, subsets containing {a,a+2,a+4} occur only when a=1.  There are 2^2 subsets including {1,3,5}, thus a(5) = 2^5 - 4 = 28.
%t A209410 LinearRecurrence[{1, 0, 2, 0, 2, 2, 0, -1, -1}, {1, 2, 4, 8, 16, 28, 49, 91, 169}, 40]
%o A209410 (Python)
%o A209410 #Returns the actual list of valid subsets
%o A209410 def avoidscode(n,bitstring=(1,0,1,0,1)):
%o A209410  patterns=list()
%o A209410  for start in range (1,n-len(bitstring)+2):
%o A209410   s=set()
%o A209410   for i in range(len(bitstring)):
%o A209410    if bitstring[i]:
%o A209410     s.add(start+i)
%o A209410   patterns.append(s)
%o A209410  s=list()
%o A209410  for i in range(sum(bitstring)):
%o A209410   for smallset in comb(range(1,n+1),i):
%o A209410    s.append(smallset)
%o A209410  for i in range(sum(bitstring),n+1):
%o A209410   for temptuple in comb(range(1,n+1),i):
%o A209410    tempset=set(temptuple)
%o A209410    for sub in patterns:
%o A209410     if sub <= tempset:
%o A209410      status=False
%o A209410      break
%o A209410    if status:
%o A209410     s.append(tempset)
%o A209410  return s
%o A209410 #Counts all such sets
%o A209410 def countavoidscode(n,bitstring=(1,0,1,0,1)):
%o A209410  return len(avoidscode(n))
%o A209410 #From recurrence
%o A209410 def a(n, adict={0:1, 1:2, 2:4, 3:8, 4:16, 5:28, 6:49, 7:91, 8:169}):
%o A209410  if n in adict:
%o A209410   return adict[n]
%o A209410  adict[n]=a(n-1) + 2*a(n-3) + 2*a(n-5) + 2*a(n-6) - a(n-8) - a(n-9)
%o A209410  return adict[n]
%o A209410 (PARI) x='x+O('x^30); Vec((1+x+2*x^2+2*x^3+4*x^4+2*x^5-x^6-2*x^7-x^8)/( (-1+x+x^2+x^3)*(-1-x^2-x^4+x^6))) \\ _G. C. Greubel_, Jan 05 2018
%o A209410 (Magma) I:=[1, 2, 4, 8, 16, 28, 49, 91, 169]; [n le 9 select I[n] else Self(n-1)+2*Self(n-3)+2*Self(n-5)+2*Self(n-6)-Self(n-8)-Self(n-9): n in [1..30]]; // _G. C. Greubel_, Jan 05 2018
%Y A209410 Cf. A209408, A209409
%K A209410 nonn,easy
%O A209410 0,2
%A A209410 _David Nacin_, Mar 08 2012