1
0
Fork 0

problem 25

This commit is contained in:
H Hautakoski 2010-07-13 09:43:26 +02:00
parent b51b2ba5fc
commit 296a8b84c3

24
p25.c Normal file
View file

@ -0,0 +1,24 @@
/*
* http://projecteuler.net
*
* Projecteuler - Problem 25
* -----------------------
* 2010-07-13 Henrik Hautakoski
*
* Alot of math, binet's formula
*/
#include <math.h>
#include <stdio.h>
#define LOG10PHI 0.20898764024997876221 /* log10((1+sqrt(5))/2) */
#define MAGIC 0.65051499783199062676 /* |(log10(5) / 2) - 1| */
#define fibolen(n) ((int) ceil(((n) - MAGIC) / LOG10PHI))
int main() {
printf("%i\n", fibolen(1000));
return 0;
}