All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Primed Palindromes (Posted on 2008-12-27) Difficulty: 2 of 5
A prime number less than 100 is increased by 1 and squared.
This square is incremented by 1 to yield a prime which is then squared.
The digits of this second square are reversed and added to that square resulting in a palindrome.

For which primes does this occur?

See The Solution Submitted by brianjn    
Rating: 5.0000 (1 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 2 of 3 |

The primes are 19 and 89:

  n (n+1)^2  (n+1)^2+1    ((n+1)^2+1)^2  palindromic
             also prime                      sum
 19    400        401          160801      268862
 89   8100       8101        65626201    75888857

   10   while N<100
   20    N=nxtprm(N)
   30    Sq=(N+1)^2
   40    Pr=Sq+1
   50    if prmdiv(Pr)=Pr then
   60      :Prsq=Pr*Pr:P2=Prsq
   70      :Revd=0
   80      :while P2>0
   90        :Revd=10*Revd+P2@10:P2=P2\10
  100      :wend
  110      :Pal=Prsq+Revd
  120      :S=cutspc(str(Pal))
  130      :Good=1
  140      :for I=1 to int(len(S)/2)
  150        :if mid(S,I,1)<>mid(S,len(S)+1-I,1) then Good=0:endif
  160      :next I
  170      :if Good then print N;Sq;Pr;Prsq;Pal
  180   wend

  Posted by Charlie on 2008-12-27 23:47:41
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (24)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information