Skip to content

Instantly share code, notes, and snippets.

@sh1boot
Created June 8, 2016 17:09
Show Gist options
  • Save sh1boot/9ca3af219193e933ba5880cc46a19795 to your computer and use it in GitHub Desktop.
Save sh1boot/9ca3af219193e933ba5880cc46a19795 to your computer and use it in GitHub Desktop.
odd output
#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