Search: id:A143662 Results 1-1 of 1 results found. %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 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<