I know of two methods for prime decomposition of a given integer:
Method One: We find all prime factors by starting with the smallest prime number.
Method two: We split the number as the product of two integers not necessarily primes and continue splitting each factor into further factors until all factors are primes.
My first question is how can I prove that any of these methods will give the correct prime decomposition? (no full solution is required as a hint is more than enough)
My second question is that what algorithm do computers use for decomposing a very large number into its prime factors?