#include <stdio.h>
int main( int argc, char const * argv[ ] ) {
//we declare the variable for our algorithm
int n, //n input
i, //start with a variable i
fm; //multiplicity factor
printf ( "%s" , "Fundamental Theorem of Arithmentic\n " ) ; printf ( "%s\n " , "Source: https://m...content-available-to-author-only...m.com/FundamentalTheoremofArithmetic.html" ) ; //read an integer
//start with i equal 2
i = 2 ;
do {
fm = 0 ;
while ( ( n % i) == 0 ) {
fm++;
n /= i;
}
if ( n
== 1 ) printf ( "%d ^ %d" , i
, fm
) ; else
if ( fm
!= 0 ) printf ( "%d ^ %d * " , i
, fm
) ;
i++;
} while ( ! ( n == 1 ) ) ;
return 0 ;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbihpbnQgYXJnYywgY2hhciBjb25zdCAqYXJndltdKSB7CgogIC8vd2UgZGVjbGFyZSB0aGUgdmFyaWFibGUgZm9yIG91ciBhbGdvcml0aG0KICBpbnQgbiwgLy9uIGlucHV0CiAgICAgIGksIC8vc3RhcnQgd2l0aCBhIHZhcmlhYmxlIGkKICAgICAgZm07Ly9tdWx0aXBsaWNpdHkgZmFjdG9yCgogIHByaW50ZigiJXMiLCJGdW5kYW1lbnRhbCBUaGVvcmVtIG9mIEFyaXRobWVudGljXG4iKTsKICBwcmludGYoIiVzXG4iLCJTb3VyY2U6IGh0dHBzOi8vbS4uLmNvbnRlbnQtYXZhaWxhYmxlLXRvLWF1dGhvci1vbmx5Li4ubS5jb20vRnVuZGFtZW50YWxUaGVvcmVtb2ZBcml0aG1ldGljLmh0bWwiKTsgIAogIHByaW50ZigiJXMiLCJHaXZlIGEgTiA9ICIpOwogIC8vcmVhZCBhbiBpbnRlZ2VyCiAgc2NhbmYoIiVkIiwgJm4pOwoKICBwcmludGYoIiVkID0gIiwgbik7CiAgLy9zdGFydCB3aXRoIGkgZXF1YWwgMgogIGkgPSAyOwogIGRvIHsKCiAgICAgIGZtID0gMDsKCiAgICAgIHdoaWxlKCAobiAlIGkpID09IDApIHsKCiAgICAgICAg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