%I A143662
%S A143662 0,0,0,0,0,0,1,3,8,20,48,112,256,575,1275,2798,6088,13152,28240,60320,
%T A143662 128257,271623,573216,1205880,2529680,5293264,11050496,23021311,
%U A143662 47868151
%N A143662 a(n) is the number of n-tosses having a run of 6 or more heads for a
fair coin (i.e. probability is a(n)/2^n).
%o A143662 /*C++*/ #include <iostream> using namespace std; typedef unsigned long
long __Int; const size_t MAX_M = sizeof(__Int) * 8; __Int countProp(__Int
N,__Int M) { if(M > __Int(MAX_M)) return 0; else if(N > M) return
0; const __Int MASK = (__Int(1) << N) - 1; const __Int END = (__Int(1)
<< M) - 1; __Int ret = 0; for(__Int i = 0;i < END;++i){ for(__Int
j = 0;j <= (M - N);++j){ const __Int m = MASK << j; if((i & m) ==
m){ ++ret; break; } } } return ++ret; } int main() { const __Int
N = 6; for(__Int m = 0;m <= __Int(MAX_M);++m) cout<<countProp(N,m)<<endl;
}
%Y A143662 Sequence in context: A026712 A050232 A050233 this_sequence A049610 A001792
A018795
%Y A143662 Adjacent sequences: A143659 A143660 A143661 this_sequence A143663 A143664
A143665
%K A143662 nonn
%O A143662 1,8
%A A143662 DoZerg (daidodo(AT)gmail.com), Aug 28 2008
|