Created
June 8, 2016 17:09
-
-
Save sh1boot/9ca3af219193e933ba5880cc46a19795 to your computer and use it in GitHub Desktop.
odd output
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main(void) { | |
long double x = 0.0; | |
long double phi = 0.61803398874989484820458683436563811772030917980576286213544862L; | |
long double t = 1.0; | |
for (;;) { | |
int n = 0; | |
do { | |
x = fmodl(x + phi, 1.0); | |
n++; | |
} while (x > t); | |
printf("%d\n", n); | |
t /= 1.1; | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment