2 ms·
// بسم الله الرحمن الرحيم #include "stdio.h" #include "stdlib.h" #include "math.h" int main() { long unsigned stop, index=1, primeCounter=0, primeIndex=0;
by abdessamad 8y ago
// بسم الله الرحمن الرحيم
#include "stdio.h"
#include "stdlib.h"
#include "math.h"
int main() {
long unsigned stop, index=1, primeCounter=0, primeIndex=0;
printf("Number to identify : ");
scanf("%lu", &stop);
long unsigned primeList[stop];
while (stop>=index) {
primeCounter++;
if ((long unsigned)sqrt(index)!=(long unsigned)sqrt(index+1)) {
primeList[primeIndex]=primeCounter;
primeIndex++;
primeCounter=0;
}
index++;
}
long unsigned primeCounterList[primeCounter];
long unsigned primeCounterVar=0, primeCounterIndex=0, indexVar=1;
while (primeCounter!=0 && primeCounter!=1 && primeCounter!=2) {
indexVar=1;
while (primeCounter>=indexVar) {
primeCounterVar++;
if (((long unsigned)sqrt(indexVar))!=((long unsigned)sqrt(indexVar+1))) {
primeCounterList[primeCounterIndex]=primeCounterVar;
primeCounterIndex++;
primeCounterVar=0;
}
indexVar++;
}
primeCounter=primeCounterVar;
primeCounterVar=0;
}
printf("[+] : %lu = ", stop);
for (int c = 0; c < primeIndex; c++) {
printf("%lu + ", primeList[c]);
}
for (int c = 0; c < primeCounterIndex; c++) {
printf("%lu + ", primeCounterList[c]);
}
printf("%lu \n", primeCounter);
printf(" : %lu = ", stop);
for (int c = 0; c < primeIndex; c++) {
printf("%d + %d + ", c+1, c+2);
}
for (int c = 0; c < primeCounterIndex; c++) {
printf("%d + %d + ", c+1, c+2);
}
printf("%lu \n", primeCounter);
printf("[] : %lu = ", stop);
for (int c = 0; c < primeIndex; c++) {
if (stop%primeList[c]==0) {
printf("%lu %lu = ", stop/primeList[c], primeList[c]);
}
}
printf("%lu * 1 \n", stop);
printf("[=] : %lu = ", stop);
for (int c = 0; c < primeIndex; c++) {
printf("%lu + ", primeList[c]);
}
for (int c = 0; c < primeCounterIndex; c++) {
printf("%lu + ", primeCounterList[c]);
}
printf("%lu = ", primeCounter);
for (int c = 0; c < primeIndex; c++) {
printf("%d + %d + ", c+1, c+2);
}
for (int c = 0; c < primeCounterIndex; c++) {
printf("%d + %d + ", c+1, c+2);
}
printf("%lu = ", primeCounter);
for (int c = 0; c < primeIndex; c++) {
if (stop%primeList[c]==0) {
printf("%lu * %lu = ", stop/primeList[c], primeList[c]);
}
}
printf("%lu * 1 \n", stop);
printf(" : %lu = ", stop);
for (int c = 1; c < primeIndex; c++) {
if (((long unsigned)pow(stop,primeList[c])-stop)-((((long unsigned)pow(stop,primeList[c])-stop)/primeList[c])primeList[c])==0) {
printf("%0.f - %lu %lu = ", pow(stop,primeList[c]), ((long unsigned)pow(stop,primeList[c])-stop)/primeList[c], primeList[c]);
}
}
printf("%lu * 1 \n", stop);
for (int c = 1; c < primeIndex; c++) {
if (((long unsigned)pow(stop,primeList[c])-stop)-((((long unsigned)pow(stop,primeList[c])-stop)/primeList[c])primeList[c])==0) {
printf("[≅] : %0.f - %lu = %lu %lu \n", pow(stop,primeList[c]), stop, ((long unsigned)pow(stop,primeList[c])-stop)/primeList[c], primeList[c]);
printf(" : Power(%lu, %lu) ≅ %lu [%lu] \n", stop, primeList[c], stop, primeList[c]);
}
}
return 0;
}
// الحمد لله رب العالمين
- gus_massa 8y agoAdd two spaces before each line to get a good formatting here int main() { printf("Hello, World!"); return 0; }