4 ms·
Number identification with prime and semi-prime numbers
Salam,
I think there is a way to identify any number not just by decomposition to prime factors but also through a sum containing primes and semi primes.
here is an example :
Number to identify : 114
[+] : 114 = 3 + 5 + 7 + 9 + 11 + 13 + 15 + 17 + 19 + 3 + 5 + 7 + 0
: 114 = 1 + 2 + 2 + 3 + 3 + 4 + 4 + 5 + 5 + 6 + 6 + 7 + 7 + 8 + 8 + 9 + 9 + 10 + 1 + 2 + 2 + 3 + 3 + 4 + 0
[] : 114 = 38 3 = 6 * 19 = 114 * 1
[=] : 114 = 3 + 5 + 7 + 9 + 11 + 13 + 15 + 17 + 19 + 3 + 5 + 7 + 0 = 1 + 2 + 2 + 3 + 3 + 4 + 4 + 5 + 5 + 6 + 6 + 7 + 7 + 8 + 8 + 9 + 9 + 10 + 1 + 2 + 2 + 3 + 3 + 4 + 0 = 38 * 3 = 6 * 19 = 114 * 1
: 114 = 19254145824 - 3850829142 * 5 = 250226879128704 - 35746697018370 * 7 = 114 * 1
[≅] : 19254145824 - 114 = 3850829142 * 5
: Power(114, 5) ≅ 114 [5]
[≅] : 250226879128704 - 114 = 35746697018370 * 7
: Power(114, 7) ≅ 114 [7]
I wrote the algorithm in C, so it easy to analyze. and ofcourse after this you can build a whole lots of arithmetic structures.
the last results are some extension of Fermat's theorems.
- 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; }