Problem 3 : Finding the Largest Prime Factor

The logic for writing this program was that, the smallest possible
integer factor for any number other than 1 is 2. So a number cannot be
divisible by any number which is larger than half it-self.
The program tries to search toward zero starting from n/2 for a number
that can divide n. If found, the search is stopped, and then resumed
starting with this new number. This is done, to remove the other
(smaller) factor, and to use the same process to factorize this newly
found factor.
But, for a large number this takes time, because it may-not have any
large factors. So, v2 includes an extra while loop to search for smaller
factors too. But this while loop is executed only after the first one
completes. And, thus produces no noticeable effect. A further
improvement is done by searching simultaneously from n/2 toward 1, and
from 1 toward n/2. When a perfect divisor is found, the loop is stopped,
and the larger factor is made the new subject of the search. When, the
number cannot be factorised anymore, the search stops.
Even then, for larger numbers ~18 digits with 8 digit prime factors,
this method proves time-taking. THe method finds the prime factor quite
early, but spends most of the time checking if the found factor is a
prime number or not. A further improvement in v4 stops the search if the
searches from both sides (i.e n/2 &1) meet, and no perfect divisors have
been found.

The first two functions that check for the largest prime factor were
good upto 6-8 digits. For the given test number they simply take too
much time.
I improved the logic: This time checking for factors from both sides:
i.e from n/2 downward & 1 upward. And, using that v3 finds the answer in
~30secs. I then tried v3 on a larger number of my own, for which it
takes over 2.5 hours.
I improved the logic further for numbers having large prime factors.
And, that is v4 of the function. Incontrast to v3, it takes ~15secs to
find the answer, because it performs far fewer calculations than v3. But
incase the prime-factors arent big enough, v3 & v4 would take the same
time.
Problem 4: Palindrome Numbers

Simple Problem.