23
2
Consider the number 99999999. That number is obviously a palindrome. The largest prime factor of 99999999 is 137. If you divide 99999999 by 137, you get 729927. This number is also a palindrome.
The largest prime factor of 729927 is 101. 729927/101=7227 which again is a palindrome.
The largest prime factor of 7227 is 73. 7227/73=99 which again is a palindrome.
By further dividing by the largest prime factor, you get 9, 3 and finally 1, which, being one-digit numbers, are also palindromes. Since 1 has no prime factors, the procedure ends here.
Now generalizing this observation, I define a super-palindrome as a palindrome which is either 1, or which gives another super-palindrome if divided by its largest prime factor.
Credits: https://math.stackexchange.com/questions/200835/are-there-infinitely-many-super-palindromes
Given a number N, determine if it is a super palindrome or not, and print a truthy or falsey value accordingly.
Your program should print a truthy value for these inputs:
1
101
121
282
313
353
373
393
474
737
919
959
1331
1441
2882
6446
7887
8668
9559
9779
Your program should print a falsey value for these inputs:
323
432
555
583
585
646
642
696
777
969
989
2112
3553
4554
5242
5225
5445
8080
8118
9988
Remember, this is code-golf, so the code with the shortest amount of bytes wins.
3Will the input
N
always be a palindrome to start with? – Sherlock9 – 2016-10-23T06:31:01.353@Sherlock9 No.. – Oliver Ni – 2016-10-23T15:00:23.910
2Then can you please add non-palindromes to the falsey test cases? It would clarify the specification. – Sherlock9 – 2016-10-23T15:13:56.023