Skip to content

Instantly share code, notes, and snippets.

@kaneshin
Created April 24, 2014 07:31
Show Gist options
  • Save kaneshin/11244992 to your computer and use it in GitHub Desktop.
Save kaneshin/11244992 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#define N 1000
void initialize(long long int *r, long long int *s, long long int *y, long long int *x);
int
main(int argc, char* argv[])
{
// z: k + 1
// y: k
// x: k - 1
long long int z, y, x = 0;
long long int i, r, s;
initialize(&r, &s, &y, &x);
for (i = 0; i < N; ++i)
{
z = y + r * x + s;
printf("%lld\t: %lld, %lld, %lld\n", i, z, y, x);
x = y;
y = z;
}
return 0;
}
void
initialize(long long int *r, long long int *s, long long int *y, long long int *x)
{
*r = 1;
*s = 0;
*y = 1;
*x = 1;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment