You are viewing a single comment's thread from:

RE: Brainsteem #9 Prize Maths Puzzle [Win 40% and 10% in SBD]

in #mathematics7 years ago

since 1+2+.......+9 = 45, so all the permutations is divisible by 9.
The question can be reduced to divisible by 11.
This can be checked by d1+d2-d3+d4.....-d9
the range of the equation is -25 to 25
we can just hardcode to check -22,-11,11,22

matlab time:

allperm = perms(1:9);

reduced = allperm(:,1)-allperm(:,2)+allperm(:,3)-allperm(:,4)+allperm(:,5)-allperm(:,6)+allperm(:,7)-allperm(:,8)+allperm(:,9);

sum((reduced(:)==11)+(reduced(:)==-11)+(reduced(:)==-22)+(reduced(:)==22))/length(allperm)

ans = 11/126

11+126 = 137

Coin Marketplace

STEEM 0.21
TRX 0.20
JST 0.035
BTC 91178.33
ETH 3192.43
USDT 1.00
SBD 2.96