Re: Recursive prime checking



* Marian Samsung:
Is it possible witha given number ?

You can use a loop to check for primeness. Any loop can be rewritten as recursion.


I am stuck because the return value is doubled not singled.

?

--
A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
.



Relevant Pages

  • Re: Response to Karen and to Willem on recursive proofs
    ... >) int nFactorial ... The bits with 'max' are because the loop is a bit ... I agree that this does not need recursion and it is an elegant ... language proofs can be used, and I need to keep the language informal ...
    (comp.programming)
  • Re: StackOverflowException with attribute
    ... I figured that the recursion wasn't infinite. ... it would seem that the call to GetProperties on the ... You need to find some way to break this loop. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: CAS, Lambda Calculus, Continuation and Functional Programming
    ... >>Recursion that's equivalent to loops can always be optimized back into ... and that tail calls are equivalent to loops. ... If a loop is formulated in a recursive way then ... >> that makes tail call elimination less attractive for compiler writers. ...
    (sci.math.symbolic)
  • Re: Iteration in lisp
    ... recursive function can run out of stack since CL does not guarantee ... In loop you would usually only need one change. ... So using tail recursion rather than a loop can introduce bugs in complex looping constructs. ...
    (comp.lang.lisp)
  • Re: Halting Problem
    ... large due to recursion. ... there is a condition for the recursion to terminate. ... they don't have infinite memory. ... All programs without any loop, ...
    (comp.programming)