Skip to content

Instantly share code, notes, and snippets.

@onokatio
Created August 27, 2020 16:22
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 onokatio/4c297326faf508e0a27f8056cc28a1b6 to your computer and use it in GitHub Desktop.
Save onokatio/4c297326faf508e0a27f8056cc28a1b6 to your computer and use it in GitHub Desktop.
#include <stdio.h>
#include <math.h>
int calc(int i,int j,int k){
return pow(2,i) * pow(3,j) * pow(5,k);
}
int main(void){
int count = 0;
int amari;
int multiply = 1;
int i,j,k;
while(count < 100){
i=j=k=0;
int n = multiply;
while(n % 2 == 0 && n >= 2){
i++;
n /= 2;
}
while(n % 3 == 0 && n >= 3){
j++;
n /= 3;
}
while(n % 5 == 0 && n >= 5){
k++;
n /= 5;
}
if(n == 1){
printf("%d = %d %d %d\n",30 * multiply,i,j,k);
count++;
}
multiply++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment