#include <stdio.h>
int prime_factor(int n,int x){
if(x<2){
return 1;
//因数ではない
}
else if(n%x==0){
int b;
b=x;
//2以上の因数
int p=pri(b,b-1);
if(p==4){
}
else if(p==3){
printf("%dは%dの因数であるが、素因数ではない\n",x
,n
); }
return prime_factor(n,x-1);
}
else{
return prime_factor(n,x-1);
}
}
//aは判定したい数、bは2~aまでの数
int pri(int a,int b){
if(b<2){
return 4;//素数である
}
else if(a%b==0){
return 3;//素数ではない
}
else{
return pri(a,b-1);//判定されるまで再帰呼び出し
}
}
int main(){
int m;
printf("%d\n",prime_factor
(m
,m
)); return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgcHJpbWVfZmFjdG9yKGludCBuLGludCB4KXsKICAgIGlmKHg8Mil7CiAgICAgICAgcmV0dXJuIDE7CiAgICAgICAgLy/lm6DmlbDjgafjga/jgarjgYQKICAgIH0KICAgIGVsc2UgaWYobiV4PT0wKXsKICAgICAgICBpbnQgYjsKICAgICAgICBiPXg7CiAgICAgICAgLy8y5Lul5LiK44Gu5Zug5pWwCiAgICAgICAgaW50IHA9cHJpKGIsYi0xKTsKICAgICAgICBpZihwPT00KXsKICAgICAgICAgICAgcHJpbnRmKCIlZOOBryVk44Gu57Sg5Zug5pWw44Gn44GC44KLXG4iLHgsbik7CiAgICAgICAgfQogICAgICAgIGVsc2UgaWYocD09Myl7CiAgICAgICAgICAgIHByaW50ZigiJWTjga8lZOOBruWboOaVsOOBp+OBguOCi+OBjOOAgee0oOWboOaVsOOBp+OBr+OBquOBhFxuIix4LG4pOwogICAgICAgIH0KICAgICAgICByZXR1cm4gcHJpbWVfZmFjdG9yKG4seC0xKTsKICAgIH0KICAgIGVsc2V7CiAgICAgICAgcHJpbnRmKCIlZOOBryVk44Gu5Zug5pWw44Gn44Gv44Gq44GEXG4iLHgsbik7CiAgICAgICAgcmV0dXJuIHByaW1lX2ZhY3RvcihuLHgtMSk7CiAgICB9Cgp9Ci8vYeOBr+WIpOWumuOBl+OBn+OBhOaVsOOAgWLjga8yfmHjgb7jgafjga7mlbAKaW50IHByaShpbnQgYSxpbnQgYil7CiAgICBpZihiPDIpewogICAgICAgIHJldHVybiA0Oy8v57Sg5pWw44Gn44GC44KLCiAgICB9CiAgICBlbHNlIGlmKGElYj09MCl7CiAgICAgICAgcmV0dXJuIDM7Ly/ntKDmlbDjgafjga/jgarjgYQKICAgIH0KICAgIGVsc2V7CiAgICAgICAgcmV0dXJuIHByaShhLGItMSk7Ly/liKTlrprjgZXjgozjgovjgb7jgaflho3luLDlkbzjgbPlh7rjgZcKICAgIH0KfQoKaW50IG1haW4oKXsKICAgIGludCBtOwogICAgc2NhbmYoIiVkIiwmbSk7CiAgICBwcmludGYoIiVkXG4iLHByaW1lX2ZhY3RvcihtLG0pKTsKICAgIHJldHVybiAwOwp9Cg==