Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beyondlimits/8ea49062ef513477ff6c57d49fd5b58c to your computer and use it in GitHub Desktop.
Save beyondlimits/8ea49062ef513477ff6c57d49fd5b58c to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <stdlib.h>
#define LOG_2 0x02000000
#define LOG_3 0x032B8034
#define LOG_5 0x04A4D3C2
#define LOG_7 0x059D5D9F
#define LOG_LIMIT 0x80000000
int main()
{
unsigned l2, l3, l5, l7;
unsigned long long x2, x3, x5, x7;
for (
l2 = 0, x2 = 1;
l2 < LOG_LIMIT;
l2 += LOG_2, x2 *= 2
) {
for (
l3 = l2, x3 = x2;
l3 < LOG_LIMIT;
l3 += LOG_3, x3 *= 3
) {
for (
l5 = l3, x5 = x3;
l5 < LOG_LIMIT;
l5 += LOG_5, x5 *= 5
) {
for (
l7 = l5, x7 = x5;
l7 < LOG_LIMIT;
l7 += LOG_7, x7 *= 7
) {
printf("%Lu\n", x7);
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment