Re: Learning recursion with hailstone seqence
- From: Hans-Peter Diettrich <DrDiettrich1@xxxxxxx>
- Date: Fri, 17 Nov 2006 11:25:20 +0100
Maarten Wiltink wrote:
1. Can this function be optimised ? (approx 2^67 iterations are
neccessary on current dataset)
It's tail-recursive. You can rewrite it as a loop. Other than that,
there really isn't much room for optimisation - it's a very short
and easy function.
Perhaps using shorter values or using MMX in some way, but I'm not
qualified to say anything about that.
That's all correct, but...
I'd simply wait a few (hundred) years, until a dramatically faster technology becomes available. When a single iteration is performed at 4 GHz, the loop will terminate in about 2000 years.
As a raw guess, I'd predict that the result will be near 42 ;-)
DoDi
.
- References:
- Learning recursion with hailstone seqence
- From: DAVID B MORGAN
- Re: Learning recursion with hailstone seqence
- From: Maarten Wiltink
- Learning recursion with hailstone seqence
- Prev by Date: Re: Learning recursion with hailstone seqence
- Next by Date: Re: Learning recursion with hailstone seqence
- Previous by thread: Re: Learning recursion with hailstone seqence
- Next by thread: Re: Learning recursion with hailstone seqence
- Index(es):
Relevant Pages
|