We don't bite newbies here... much PerlMonks

### Comment on

 Need Help??
This is actually a simpler problem, because the output for each iteration comes directly off of one of the input streams. One interesting property of that is that you can easily advance yourself in the output stream without generating the whole sequence.
```use strict;
use warnings;

{
my @streams = map [\$_, 0], (2,3,5);
sub limbic_sequence {
my \$first_after = shift;
if (defined \$first_after) {
\$_->[1] = int(\$first_after/\$_->[0]) for @streams;
}
my (\$lowest) = sort {\$a <=> \$b} map {(\$_->[1]+1) * \$_->[0]} @s
+treams;
\$_->[1]++ for grep {(\$_->[1]+1) * \$_->[0] == \$lowest} @streams
+;
\$lowest;
}
}

print join ', ', map limbic_sequence, 1..50;
print "\n";
printf "First after 100000 is: %d\n", limbic_sequence(100000);
print join ', ', map limbic_sequence, 1..50;
print "\n";
__END__
#Output
2, 3, 4, 5, 6, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 22, 24, 25, 26, 2
+7, 28, 30, 32, 33, 34, 35, 36, 38, 39, 40, 42, 44, 45, 46, 48, 50, 51
+, 52, 54, 55, 56, 57, 58, 60, 62, 63, 64, 65, 66, 68
First after 100000 is: 100002
100004, 100005, 100006, 100008, 100010, 100011, 100012, 100014, 100015
+, 100016, 100017, 100018, 100020, 100022, 100023, 100024, 100025, 100
+026, 100028, 100029, 100030, 100032, 100034, 100035, 100036, 100038,
+100040, 100041, 100042, 100044, 100045, 100046, 100047, 100048, 10005
+0, 100052, 100053, 100054, 100055, 100056, 100058, 100059, 100060, 10
+0062, 100064, 100065, 100066, 100068, 100070, 100071

Caution: Contents may have been coded under pressure.

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.
• Please read these before you post! —
• 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?
• See Writeup Formatting Tips and other pages linked from there for more info.

Create A New User
Chatterbox?
 [LanX]: I told you the story about the “new" currency trading system of Dresdner Bank [LanX]: ? [Corion]: No, or I don't remember the story ;) LanX my favourite don't tell me the proof of concept is good enough for production anecdote

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (10)
As of 2017-03-29 11:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
Should Pluto Get Its Planethood Back?

Results (348 votes). Check out past polls.