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

Home > Numbers
Prime+reversal= prime (Posted on 2014-03-04) Difficulty: 2 of 5
Find the smallest prime which can be represented as sum of a prime and its reversal.

See The Solution Submitted by Ady TZIDON    
No Rating

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

10   while Ct<44
20     P=nxtprm(P)
30     Ps=cutspc(str(P))
40     Rvs=""
50     for I=1 to len(Ps):Rvs=mid(Ps,I,1)+Rvs:next
60     Rv=val(Rvs)
70     P2=P+Rv
80     if prmdiv(P2)=P2 then print using(7,0),P,Rv,P2:Ct=Ct+1
90   wend

lists them, but not in order of total, so one must seek the smallest total, 383:

 prime    rev   total
  229     922    1151
  239     932    1171
  241     142     383
  257     752    1009
  269     962    1231
  271     172     443
  277     772    1049
  281     182     463
  439     934    1373
  443     344     787
  463     364     827
  467     764    1231
  479     974    1453
  499     994    1493
  613     316     929
  641     146     787
  653     356    1009
  661     166     827
  673     376    1049
  677     776    1453
  683     386    1069
  691     196     887
  811     118     929
  823     328    1151
  839     938    1777
  863     368    1231
  881     188    1069
20011   11002   31013
20029   92002  112031
20047   74002   94049
20051   15002   35053
20101   10102   30203
20161   16102   36263
20201   10202   30403
20249   94202  114451
20269   96202  116471
20347   74302   94649
20389   98302  118691
20399   99302  119701
20441   14402   34843
20477   77402   97879
20479   97402  117881
20507   70502   91009
20521   12502   33023
 

  Posted by Charlie on 2014-03-04 15:08:19
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 (11)
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