Haven't looked at the code, but to answer your question about `for`-loops...
"for each" loops:
http://docs.factorcode.org/content/word-each,sequences.html
"for i = 0 up to n" loops: use `each` with
http://docs.factorcode.org/content/word-iota,sequences.html
If the iteration variable is just indexing into a sequence, you can use
http://docs.factorcode.org/content/word-each-index%2Csequences.html
"while" loops: http://docs.factorcode.org/content/word-while,kernel.htmland
the variant
http://docs.factorcode.org/content/word-until%2Ckernel.html
There are other variants; take a look through the words defined in vocabs
like `sequences`. All else fails, there's good ol' fashioned tail
recursion: http://docs.factorcode.org/content/article-tail-call-opt.html
Hope these help,
--Alex Vondrak
On Thu, Jan 10, 2013 at 1:42 AM, Leonard P <leonard14...@gmail.com> wrote:
> Here's the algorithm ...
>
> Given n,
> generate successive fibonacci numbers,
> until a number greater than or equal to n is reached.
>
> If the number is equal to n, then n is a fibonacci number.
> If the number is greater than n, then n is not a fibonacci number.
>
> Sounds simple, but I don't see a way to do it recursively.
>
>
>
>
> ------------------------------------------------------------------------------
> Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
> MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
> with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
> MVPs and experts. ON SALE this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122712
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk