22e7f7f147
Method prime(num) uses only odd numbers from 3 to square root of num as divisors. In method functioning(y) we iterate over odd numbers as all even numbers (except of 2) are not prime. In method functioning(y) we check at first if the number is palindrome and then if it's prime, so we don't have to call the heavy prime() method for every number. The speed of searching palindromic primes is significantly increased. |
||
---|---|---|
.. | ||
heap_sort.java | ||
MedianOfRunningArray.java | ||
PalindromicPrime.java |