Find the greatest primefactor of a given number

Part 1 is a primality test of the input itself. This can be done using the AKS primality test for example

After that you are basically forced to brute force to find the primefactors.

Below is an implementation of the AKS primality test, limited to really small numbers (<= 30). since it is not feasible for in browser computation

Solution: