One of the central idea behind much cryptography are that factoring large numbers are computationally intensive. In this context one might use a, digit number, is a product of one of the digit prime numbers. Even with the fastest projected computers this factorization would take hundreds of years.
You don't have those computers available and if you're clever you can still factor fairly large numbers.
Input
The input would be a sequence of an integer values, one per line, and terminated by a negative number. The numbers would fit in GCC ' s long long int datatype.
Output
Each positive number from the input must is factored and all factors (other than 1) is printed out. The factors must is printed in ascending order with 4 leading spaces preceding a left justified number, and followed by a Single blank line.
Sample Input
9012345678911899132545313912745267386521023-1
Sample Output
2 3 3 5 1234567891 3 3 179 271 1381 2423 30971 411522630413
Source: Waterloo Local Contest Sep, 1996
Decomposition of the formula.
#include <stdio.h>intMain () {Long LongI,n; while(~SCANF ("%lld", &n) && n>=0){ for(i=2; N>1;){ if(n%i = =0) {printf ("%lld\n", i); N/=i; } Else{i++; if(i*i>N) {printf ("%lld\n", N); Break; }}} printf ("\ n"); } return 0; }
TOJ-1203 Factoring Large Numbers