All pastes #200363 Raw Edit

Miscellany

public text v1 · immutable
#200363 ·published 2006-10-13 03:21 UTC
rendered paste body
:begin
Start with pile U
X = (int) U/4;
Divide U into A1, A2, B1, and B2, into four parts of X coins
If count(U) < 4 goto END;
If A1 == A2 {
	If B1 == B2 {
		Shuffle(U);
		Goto begin;
	} else {
		U = (B1 + B2 + X);
	}
} else {
	U = A1 + A2 + x;
}
Goto Begin
:END
If count(U) == 2 {
        return U1, U2;
} else {