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!)
A209408 Number of subsets of {1,...,n} containing {a,a+4} for some a. 3

%I #19 Sep 08 2022 08:46:01

%S 0,0,0,0,0,8,28,74,175,377,799,1673,3471,7192,14784,30208,61440,

%T 124416,251328,506712,1020015,2051015,4119775,8268215,16582735,

%U 33239558,66599068,133392344,267099120,534709192,1070244924,2141826898,4285816671,8575127217

%N Number of subsets of {1,...,n} containing {a,a+4} for some a.

%C For n=5, subsets containing {a,a+4} occur only when a=1. There are 2^3 subsets including {1,5}, thus a(5) = 8.

%H G. C. Greubel, <a href="/A209408/b209408.txt">Table of n, a(n) for n = 0..1000</a>

%H <a href="/index/Rec#order_15">Index entries for linear recurrences with constant coefficients</a>, signature (3,-1,-2,-2,6,-2,-4,2,-6,2,4,1,-3, 1,2).

%F a(n) = 2^n - A208741(n-1).

%F a(n) = 2^n - Product_{i=0..3} Fibonacci(floor((n + i)/4) + 2).

%F a(n) = 3*a(n-1) - a(n-2) -2*a(n-3) -2*a(n-4) + 6*a(n-5) - 2*a(n-6) - 4*a(n-7) + 2*a(n-8) - 6*a(n-9) + 2*a(n-10) + 4*a(n-11) + a(n-12) - 3*a(n-13) + a(n-14) + 2*a(n-15).

%F G.f.: x^5*(8 + 4 x - 2 x^2 - 3 x^3 - 2 x^4 - x^5 - x^6 - x^7 - 2 x^8 - x^9) / ((1 - x) (1 + x) (1 - 2 x) (1 + x^2) (1 - x - x^2) (1 + 3 x^4 + x^8)).

%t Table[2^n - Product[Fibonacci[Floor[(n + i)/4] + 2], {i, 0, 3}], {n, 0, 30}]

%t LinearRecurrence[{3, -1, -2, -2, 6, -2, -4, 2, -6, 2, 4, 1, -3, 1, 2}, {0, 0, 0, 0, 0, 8, 28, 74, 175, 377, 799, 1673, 3471, 7192, 14784}, 30]

%o (Python)

%o #Returns the actual list of valid subsets

%o def contains10001(n):

%o .patterns=list()

%o .for start in range (1,n-3):

%o ..s=set()

%o ..for i in range(5):

%o ...if (1,0,0,0,1)[i]:

%o ....s.add(start+i)

%o ..patterns.append(s)

%o .s=list()

%o .for i in range(2,n+1):

%o ..for temptuple in comb(range(1,n+1),i):

%o ...tempset=set(temptuple)

%o ...for sub in patterns:

%o ....if sub <= tempset:

%o .....s.append(tempset)

%o .....break

%o .return s

%o #Counts all such sets

%o def countcontains10001(n):

%o .return len(contains10001(n))

%o #From recurrence

%o def a(n, adict={0:0, 1:0, 2:0, 3:0, 4:0, 5:8, 6:28, 7:74, 8:175, 9:377, 10:799, 11:1673, 12:3471, 13:7192, 14:14784}):

%o .if n in adict:

%o ..return adict[n]

%o .adict[n]=3*a(n-1)-a(n-2)-2*a(n-3)-2*a(n-4)+6*a(n-5)-2*a(n-6)-4*a(n-7)+2*a(n-8)-6*a(n-9)+2*a(n-10)+4*a(n-11)+a(n-12)-3*a(n-13)+a(n-14)+2*a(n-15)

%o .return adict[n]

%o (PARI) for(n=0,20, print1(2^n - fibonacci(floor(n/4) + 2)*fibonacci( floor((n + 1)/4) + 2)*fibonacci(floor((n + 2)/4) + 2)*fibonacci( floor((n + 3)/4) + 2), ", ")) \\ _G. C. Greubel_, Jan 03 2018

%o (Magma) [2^n - Fibonacci(Floor(n/4) + 2)*Fibonacci(Floor((n + 1)/4) + 2)*Fibonacci(Floor((n + 2)/4) + 2)*Fibonacci(Floor((n + 3)/4) + 2): n in [0..30]]; // _G. C. Greubel_, Jan 03 2018

%Y Cf. A031923, A209409, A209410.

%K nonn,easy

%O 0,6

%A _David Nacin_, Mar 08 2012

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 13:38 EDT 2024. Contains 371914 sequences. (Running on oeis4.)