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

Home > Numbers
Superprimes (Posted on 2011-07-18) Difficulty: 3 of 5
Consider the sequence of primes at prime positions in the sequence of primes.

3, 5, 11, 17, 31, 41, 59, 67, 83, 109...

These are the 2nd prime, the 3rd prime, the 5th prime, and so on. Call these numbers superprimes.

W, X, Y, and Z are 4 superprimes in arithmetic progression, and W<X<Y<Z. Find the smallest possible value of Z.

See The Solution Submitted by Math Man    
Rating: 3.0000 (1 votes)

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

    5   open "superprm.txt" for output as #2
   10   while 1=1
   20    P=nxtprm(P)
   30    print #2,prm(P)
   35     Ct=Ct+1
   40   wend

finds 1464 superprimes, the largest being  131071 (the 12,251st prime), before reaching UBASIC's limit as to the numeration of primes. UBASIC can't hold all these numbers in an array as it's limited to 200 variables, including array members, so the next part is done in QuickBasic.

The QuickBasic program reads the generated list to find arithmetic progressions and remember the one with the smallest high number:

DECLARE FUNCTION isSP! (x!)
DIM SHARED l
DIM SHARED ct
OPEN "superprm.txt" FOR INPUT AS #1
DO
  INPUT #1, p
  ct = ct + 1
LOOP UNTIL EOF(1)
CLOSE 1
DIM SHARED sp(ct)
OPEN "superprm.txt" FOR INPUT AS #1
ct = 0
DO
  INPUT #1, p
  ct = ct + 1
  sp(ct) = p
LOOP UNTIL EOF(1)
CLOSE 1

minim = 9999999

FOR i = 1 TO ct - 3
  FOR j = i + 1 TO ct - 2
   l = j
   a = sp(i): b = sp(j)
   incr = b - a
   c = b + incr: d = c + incr
   IF isSP(c) THEN
     IF isSP(d) THEN
       PRINT a; b; c; d
       IF d < minim THEN
         savea = a: saveb = b: savec = c: minim = d
       END IF
     END IF
   END IF
  NEXT
NEXT

PRINT savea; saveb; savec; minim

FUNCTION isSP (x)
  low = j + 1: high = ct
  DO
    middle = INT((high + low) / 2)
    IF sp(middle) > x THEN high = middle - 1
    IF sp(middle) < x THEN low = middle + 1
    IF sp(middle) = x THEN EXIT DO
  LOOP UNTIL low >= high
  middle = INT((high + low) / 2)
  IF sp(middle) = x THEN isSP = -1:  ELSE isSP = 0
END FUNCTION

It finds the series with the lowest value of Z (d in my program) is

353  431  509  587

We can verify that these are in fact superprimes from:

   10   for I=1 to 9999
   20     P=prm(I)
   30     if P=353 or P=431 or P=509 or P=587 then print I,P
   40   next

which lists which primes these are, and they are all in fact Pth primes where P is also prime:

  P    superprime
       in sequence
 71      353
 83      431
 97      509
 107     587


 
and of course the difference between successive values is the same: 78.


  Posted by Charlie on 2011-07-18 17:48:43
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 (2)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

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