NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.

Full
Abbreviated
Hidden
• I bet New Scientist publishes a correction(Score:1)

There are a total of 24 solutions to the puzzle. These 24 solutions are comprised of 10 unique integers. If you do not consider the reverse of an integer unique, there are 5 unique integers. No matter which way you slice this - there is no way to get to "six integers" unless the spec is incomplete.
• Re:(Score:1)

24 solutions? how did get them? can you show them?
• Re:(Score:1)

Well, first the math

there is 1 solution for 7, with reverse = 2
there is 3 solutions for 9, with reverse = 6
there is 1 solution for 11, with reverse = 2

2 * 6 * 2 = 24

I used a bit more complicated code than I am about to show, but you should be able to see how I came up with the 24 solutions

for my \$a (1 .. 9) {
for my \$b (grep {! /\$a/} 1 .. 9) {
for my \$c (grep {! /\$a|\$b/ 1 .. 9) {
my \$first = join '', \$a, \$b, \$c;

• Re:(Score:1)

well, you said: 1 solution for 7, with reverse 2. actually - there are 2 solutions for 7 (4 with reverse).

also - you didn't take into consideration the fact that digits cannot be reused between numbers generated for various dividers.

• Huh?(Score:1)

by Limbic Region (3985) on 2008.06.09 8:24 (#63255) Homepage Journal
With regards to the math: What I posted about 24 solutions comprised of 10 different integers was correct (as is my code). I made a mistake when I was explaining where I came up with the 24 solutions because I didn't have the code or the results in front of me. My apologies.

also - you didn't take into consideration the fact that digits cannot be reused between numbers generated for various dividers

I am not sure I understand.

for my \$a (1 .. 9) { # 1 - 9
for my \$b (grep {! /\$a/} 1 .. 9) { # 1 - 9 not used in \$a
for my \$c (grep {! /\$a|\$b/} 1 .. 9) { # 1 - 9 not used in \$a or \$b
# ...
for my \$i (grep {! /\$a|\$b|\$c|\$d|\$e|\$f|\$g|\$h/} 1 .. 9) { # 1 - 9 not in any previous loop
How is that allowing re-use?

In any event, that's not the code I used anyway. The code I used was some fancy C = N choose K iterators with a code ref passed in for combinations to skip. It would have been difficult to reproduce in the 10 minutes I allow myself in the morning to surf use.perl