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

Home > Just Math
An equation with consecutive primes (Posted on 2006-01-16) Difficulty: 2 of 5
The equation below involves four 5-digits prime numbers:

A + B + C = D

A, B and C are consecutives, B and D are palindromes.

Find A, B, C and D.

See The Solution Submitted by pcbouhid    
Rating: 3.0000 (2 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution -- spoiler | Comment 1 of 23

The UBASIC program:

   10   P1=nxtprm(9999)
   20   P2=nxtprm(P1)
   30   P3=nxtprm(P2)
   40   while P3<100000
   50     P2t=cutspc(str(P2))
   55     Good=1
   60     for I=1 to int(len(P2t)/2)
   70       if mid(P2t,I,1)<>mid(P2t,len(P2t)-I+1,1) then Good=0
   80     next
   90     if Good then
  100      :P4=P1+P2+P3
  110      :if nxtprm(P4-1)=P4 then
  120         :P4t=cutspc(str(P4))
  130         :for I=1 to int(len(P4t)/2)
  140           :if mid(P4t,I,1)<>mid(P4t,len(P4t)-I+1,1) then Good=0:endif
  150         :next
  160         :if Good then print P1;P2;P3;P4
  170     P1=P2:P2=P3:P3=nxtprm(P2)
  180   wend

finds A,B,C and D as:

 10499  10501  10513  31513

  Posted by Charlie on 2006-01-16 09:40:56
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 (3)
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