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

Home > Numbers
Permuting Primes Arithmetically (Posted on 2009-01-30) Difficulty: 2 of 5
Determine all possible triplet(s) (A, B, C) of four-digit decimal primes, with A < B < C, such that:

(i) A, B and C (in this order) are in arithmetic sequence, and:

(ii) Each of B and C is obtained by permuting the digits of A, and:

(iii) None of A, B and C can contain any leading zero.

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

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution re(3): computer exploration (spoiler?) --------- Can you check? Comment 4 of 4 |
(In reply to re(2): computer exploration (spoiler?) --------- Can you check? by K Sengupta)

Aha! Foiled by the programming language!

In QuickBasic, GWBasic, Visual Basic,

mid(H,Ix+1)

gives you the the entire remainder of string H starting with position Ix+1, as does SUBSTR(H,IX+1) in PL/I and other languages.  In UBASIC it gives only the one character at position Ix+1. If you want the whole remainder of the string you need to code an * as the third parameter.

Changing two lines:

650      H=left(H,Ix-1)+mid(H,Ix+1,*)

and


690      H=left(H,Ix-1)+mid(H,Ix+1,*)

So

The two triplets are
1487    4817    8147
2969    6299    9629


  Posted by Charlie on 2009-01-30 16:22:55
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 (14)
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