Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 39 lines (30 sloc) 680 Bytes
#include <stdlib.h>
#include <stdio.h>
/*
Para tener contexto, la capacidad necesaria para guardar un número de fibonacci:
64 bits
12200160415121876738 -- Fib(93)
18446744073709551615 -- 2^64-1
19740274219868223167 -- Fib(94)
128 bits
332825110087067562321196029789634457848 -- Fib(186)
340282366920938463463374607431768211455 -- 2^128-1
538522340430300790495419781092981030533 -- Fib(187)
*/
typedef __uint128_t NUM;
int main(int argc, char* argv[]) {
NUM a = atol(argv[1]);
NUM b = atol(argv[2]);
NUM fa = 0;
NUM fb = 1;
int cont = 0;
while (fb <= b) {
NUM ft = fa;
fa = fb;
fb = ft + fb;
if (fa >= a)
cont++;
}
printf("%d\n", cont);
return 0;
}