|
[Date Index]
[Thread Index]
[Author Index]
Re: Finding length in recursive definition?
- To: mathgroup at smc.vnet.net
- Subject: [mg60894] Re: Finding length in recursive definition?
- From: Peter Pein <petsie at dordos.net>
- Date: Sun, 2 Oct 2005 01:54:45 -0400 (EDT)
- References: <dhlcj2$d16$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Jose Reckoner wrote:
> I have something like:
> f[1] = 1
> f[2] = 3
> f[n_] := f[n] = f[n - 1] + f[n - 2]
>
> and in the course of work, f[n] gets evaluated an unknown number of
> times resulting in
>
>
>>>?f
>
> f[1] = 1
> f[2] = 3
> f[3] = 4
> f[n_] := f[n] = f[n - 1] + f[n - 2]
>
> I want to figure out the greatest integer n such that f[n] has already
> been computed and is stored. In this case, it is 3.
>
> How can I do this?
>
> Thanks!
>
> Jose
>
Max[Cases[DownValues[f][[All,1,1,1]],_Integer]]
3
Peter
Prev by Date:
How to "search" in a matrix?
Next by Date:
Re: Finding length in recursive definition?
Previous by thread:
Finding length in recursive definition?
Next by thread:
Re: Finding length in recursive definition?
|