XP is just a number PerlMonks

### comment on

 Need Help??
I found 301 years with a unique solution in the range 2000 till 3000. I used a different, IMO, simpler program than the one you describe. I think you are referring to 2001 and 2005 as candidates in the counter puzzle.

Anyway, my program is after the readmore tag.

Abigail

```#!/usr/bin/perl

use strict;
use warnings;

my \$from = 2000;
my \$till = 3000;

my @nums;
for my \$x (0 .. 9) {
for my \$y (\$x .. 9) {
for my \$z (\$y .. 9) {
my %seen;
push @nums => [grep {!\$seen {\$_} ++}
map  {s/^0{1,2}//; \$_} "\$x\$y\$z", "\$x\$z\$y",
+"\$y\$x\$z",
"\$y\$z\$x", "\$z\$x\$y",
+"\$z\$y\$x"]
}
}
}

sub all_sub_sets;
sub all_sub_sets {
return unless @_;

my \$f = shift;
my @r = all_sub_sets @_;

@r => [\$f] => map {[\$f => @\$_]} @r
}

foreach my \$num (@nums) {
my @sets = all_sub_sets @\$num;

foreach my \$set (@sets) {
local \$" = " + ";
my \$sum  = eval "@\$set";
if (\$sum >= \$from && \$sum < \$till) {
}
}
}

for my \$sum (\$from .. \$till - 1) {
local \$" = " + ";
}

In reply to Re: Coming soon: Algorithm::Loops by Abigail-II
in thread Coming soon: Algorithm::Loops by tye

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

• Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
• Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
• Read Where should I post X? if you're not absolutely sure you're posting in the right place.
• Posts may use any of the Perl Monks Approved HTML tags:
a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
• You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
 For: Use: & & < < > > [ [ ] ]
• Link using PerlMonks shortcuts! What shortcuts can I use for linking?

Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-04-17 03:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?

No recent polls found

Notices?