Forums

Fibonacci sequence

Quick find code: 55-56-974-60029865

Zephya

Zephya

Posts: 1,372 Mithril Posts by user Forum Profile RuneMetrics Profile
Here's a simple recursive implementation in java, obviously it's really inefficient as it runs on o(n^2) so you shouldn't use it to calculate any fibonacci number of decent length - the algorithm Zarfot showed is a lot better
could easily be adapted for larger numbers
assume you're trying to find the n+1st fibonacci number
public int fib(int n) {
if(n == 1 || n == 0) return n;
else return fib(n-1) + fib(*-2);
}

24-Aug-2011 20:11:58 - Last edited on 24-Aug-2011 20:14:41 by Zephya

Taylor
Aug Member 2023

Taylor

Posts: 2,568 Adamant Posts by user Forum Profile RuneMetrics Profile
#307
1523 20246 48785 91573 94477 67824 40387 23157 04355 21120 80122 67487 28603
+
2464 59335 99211 79141 39804 80062 46675 39688 18368 88835 83545 62508 87805
=
3987 79582 47997 70715 34282 47886 87062 62845 22724 09956 63668 29996 16408
3 vigintillion, 987 novemdecillion, 795 octodecillion, 824 septendecillion, 799 seksdecillion, 770 quindecillion, 715 quattuordecillion, 342 tredecillion, 824 duodecillion, 788 undecillion, 687 decillion, 62 nonillion, 628 octillion, 452 septillion, 272 sekstillion, 409 quintillion, 956 quadrillion, 636 trillion, 682 billion, 999 million, 616 thousand and 408
replaced "***tillion" with sekstillion
Awaits reply of the almighty Zarfot

02-Oct-2011 09:39:17

Taylor
Aug Member 2023

Taylor

Posts: 2,568 Adamant Posts by user Forum Profile RuneMetrics Profile
#308
2464 59335 99211 79141 39804 80062 46675 39688 18368 88835 83545 62508 87805
3987 79582 47997 70715 34282 47886 87062 62845 22724 09956 63668 29996 16408
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
6452 38918 47209 49856 74087 27949 33738 02533 41092 98792 47213 92505 04213
le bump >;/

03-Oct-2011 03:27:57

Jjumpy Kk Pp

Jjumpy Kk Pp

Posts: 604 Steel Posts by user Forum Profile RuneMetrics Profile
#309?
3987 79582 47997 70715 34282 47886 87062 62845 22724 09956 63668 29996 16408
6452 38918 47209 49856 74087 27949 33738 02533 41092 98792 47213 92505 04213
_____________________________________________________________________
9439 18500 95207 20572 08369 75836 20800 65378 63817 08749 10882 22501 20621

I think this is it...can someone check?
Geez, I hate counting long numbers but still love the fun of it too.
.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,;:l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._. :) Jjumpy :) ._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,;:l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.
Been here and been there, but still want to go over there and there.

05-Nov-2011 07:14:07 - Last edited on 05-Nov-2011 22:18:38 by Jjumpy Kk Pp

Jjumpy Kk Pp

Jjumpy Kk Pp

Posts: 604 Steel Posts by user Forum Profile RuneMetrics Profile
Is no one gonna do the next one?
.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,;:l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._. :) Jjumpy :) ._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,;:l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.,:;l|l;:,.
Been here and been there, but still want to go over there and there.

09-Nov-2011 06:08:22

Quick find code: 55-56-974-60029865 Back to Top