Cody

# Problem 1159. Coin Tossing: Probability of Same Heads for N tosses

Solution 273887

Submitted on 5 Jul 2013 by Dan
• Size: 13
• This is the leading solution.
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.5000

2   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.3750

3   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.3125

4   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.2734

5   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.2461

6   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.2256

7   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.1399

8   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.1254

9   Pass

ans = Columns 1 through 10 0.5000 0.3750 0.3125 0.2734 0.2461 0.2256 0 0 0 0 Columns 11 through 20 0 0 0 0 0 0.1399 0 0 0 0.1254 Columns 21 through 30 0 0 0 0.1146 0 0 0 0 0 0 Columns 31 through 40 0 0.0993 0 0 0 0 0 0 0 0 Columns 41 through 50 0 0 0 0 0 0 0 0 0 0 Columns 51 through 60 0 0 0 0 0 0 0 0 0 0 Columns 61 through 64 0 0 0 0.0704 ans = 0.1146

10   Pass
%% assert(~isequal(1,2))

11   Pass