Category: Sample Java Programs

Java Program that will encode a number n as an array that contains the prime numbers

The fundamental theorem of arithmetic states that every natural number greater than 1 can be written as a unique product of prime numbers. So, for instance, 6936=2*2*2*3*17*17. A method named encodeNumber will encode a number n as an array that contains the prime numbers that, when multipled together, will equal n. So encodeNumber(6936) would return