I just stumbled across a collection of math problems on a blog by a Mr. Rand Wise. As an example, I find this one interesting. It is not too difficult, buy yet requires an inventive and structured approach. And it paves the road to generalizations.
After getting a formula for the general problem (which I hope is correct), I checked the result with a simple Euler code.
>load perm Functions for permutations. >s=0; >function pf (x) ... $ global s; $ s=s+100*x+10*x+x; $ endfunction >s=0; forAllChoices("pf",4,3); s,
I removed the answer. I do not want to spoil your efforts.
Update: The answer is now on that page. But without any reasoning or mathematical background, thus worthless.