Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: Misunderstanding Recursion

by ikegami (Patriarch)
on Dec 15, 2006 at 22:46 UTC ( [id://590143]=note: print w/replies, xml ) Need Help??


in reply to Misunderstanding Recursion

Bug! The for loop from one call to prime can clobber the $i of a loop in progress in a parent call.

for($i=3;$i<=sqrt($n);$i+=2){
should be
for(my $i=3;$i<=sqrt($n);$i+=2){

Use use strict!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://590143]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-18 04:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found