Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re: help with simplifying program

by snoopy (Deacon)
on May 24, 2013 at 05:50 UTC ( #1035068=note: print w/replies, xml ) Need Help??

in reply to help with simplifying program

Hi There, I'm not sure, if the unless condition is actually filtering anything:
use strict; my $n1; my $n2; foreach my $w (3..100) { foreach my $x (2..$w-1) { foreach my $y (1..$x-1) { foreach my $z (0..$y-1) { foreach my $s (1..20) { $n1++; unless ( $x == $w + $s && $y == $x + $s && $z == $y + $s ) { $n2++; } } } } } } print "n1: $n1\n"; print "n2: $n2\n";
n1: 81658500 n2: 81658500

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1035068]
[jedikaiti]: wheee
[Discipulus]: bravo the $employer who pay 1.340 neuros + vat ;=)
[Discipulus]: but i'd need 2 courses o acces the first lvl examen: they didnt pay it this year
[1nickt]: damn. pricey. I would have said there's not much to learn but apt-get, and do everything else in Perl ... but maybe I am forgetting some of the learning curve ;-)
[Discipulus]: the teacher is a python programmer.. ;=) he said it was fshion when he had to choose..

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (10)
As of 2017-12-11 17:16 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (308 votes). Check out past polls.