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

Home > Numbers
Prime Hopscotch (Posted on 2010-01-06) Difficulty: 4 of 5
Replace the numerals 1 through 8 with ever increasing prime numbers, always using the next lowest possible that is available1 to fulfill the criteria on the left. Then do the same for the right.

Present a series for the left, and one for the right.

7 + 8 = Square

6 = Prime

4 + 5 = Square


1 + 2 + 3 = Square


















7 + 8 = Cube

6 = Prime

4 + 5 = Cube


1 + 2 + 3 = Cube






If it was required that the Right set required "1" to be the next Prime following on after that used for the "8" in the Left set, what might the Right set read, if indeed it is possible?

1. Note, "always using the next lowest possible that is available" means that if it is next on the list it cannot be dismissed unless it is the last of a group of two or three and will not fulfill the criterion. Only then may you advance to the next.

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

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution computer solution | Comment 5 of 17 |
Part 1a:
list
   10   dim Pr(16)
   15   input Strt
   20   Pr(1)=Strt
   30   gosub *Addon(2)
   40   end
  200   *Addon(N)
  210   X=nxtprm(Pr(N-1))
  220   if N=3 and fnSq(Pr(1)+Pr(2)+X)=0 then X=nxtprm(X):goto 220
  230   if N=5 and fnSq(Pr(4)+X)=0 then X=nxtprm(X):goto 220
  240   if N=8 and fnSq(Pr(7)+X)=0 then X=nxtprm(X):goto 220
  250   Pr(N)=X
  260   if N=8 then
  270     :for I=1 to 8:print Pr(I);:next:print:end
  280    :else
  290     :gosub *Addon(N+1)
  300   return
  500   fnSq(N)
  510   Sr=int(sqrt(N)+0.5)
  520   if Sr*Sr=N then return(1):else return(0)
  530   return
OK
 

In the below runs, the "No gosub" response at the end has been omitted (resulting from ending the program with gosubs (calls) pending).

 
run
? 2
 2  3  11  13  23  29  31  113
run
? 3
 3  5  17  19  557  563  569  587
run
? 5
 5  7  13  17  19  23  29  71
run
? 7
 7  11  31  37  107  109  113  211
run
? 11
 11  13  97  101  223  227  229  347
run
? 13
 13  17  19  23  41  43  47  53
run
? 17
Break in 220
run
? 19
 19  23  79  83  113  127  131  193
run
? 23
 23  29  173  179  397  401  409  491
 

Note that a satisfactory solution starting with 17 was not being found, so the program was halted.

 
Part 1b:
list
   10   dim Pr(16)
   15   input Strt
   20   Pr(1)=Strt
   30   gosub *Addon(2)
   40   end
  200   *Addon(N)
  210   X=nxtprm(Pr(N-1))
  220   if N=3 and fnCu(Pr(1)+Pr(2)+X)=0 then X=nxtprm(X):goto 220
  230   if N=5 and fnCu(Pr(4)+X)=0 then X=nxtprm(X):goto 220
  240   if N=8 and fnCu(Pr(7)+X)=0 then X=nxtprm(X):goto 220
  250   Pr(N)=X
  260   if N=8 then
  270     :for I=1 to 8:print Pr(I);:next:print:end
  280    :else
  290     :gosub *Addon(N+1)
  300   return
  500   fnCu(N)
  510   Cr=int((N)^(1/3)+0.5)
  520   if Cr*Cr*Cr=N then return(1):else return(0)
  530   return
run
? 2
 2  3  59  61  1667  1669  1693  4139
run
? 3
 3  5  19  23  41  43  47  953
run
? 5
 5  7  113  127  1601  1607  1609  25391
run
? 7
 7  11  107  109  1619  1621  1627  6373
run
? 11
 11  13  101  103  113  127  131  1597
run
? 13
 13  17  313  317  683  691  701  38603
run
? 17
 17  19  89  97  2647  2657  2659  30109
run
? 19
 19  23  83  89  127  131  137  863
run
? 23
 23  29  73  79  137  139  149  1579
run
? 29
 29  31  283  293  3803  3821  3823  4177
No gosub
Part 2:
Changing line 20 of the cube version to
   20   Pr(1)=nxtprm(Strt)
  
  
Starting with the terminal numbers from part 1a:
run
? 113
 127  131  11909  11923  15077  15083  15091  58997
run
? 587
 593  599  8069  8081  18919  18947  18959  27697
run
? 71
 73  79  191  193  2551  2557  2579  3253
run
? 211
 223  227  881  883  1861  1867  1871  11953
run
? 347
 349  353  4211  4217  22783  22787  22807  152809
run
? 53
 59  61  223  227  773  787  797  3299
run
? 193
 197  199  1801  1811  4021  4027  4049  6599
run
? 491
 499  503  3911  3917  9907  9923  9929  87407
No gosub
 

The best in terms of the lowest final number seems to be:

 
  29  71  sq=100
    23
  17  19  sq=36
    13    sq=25
     7
     5
 
followed by 
 
2579  3253 cu=5832
   2557
 193  2551 cu=2744
    191    cu=343
     79
     73
and also, for low numbers in general
  47  53  sq=100
    43
  23  41  sq=64
    19    sq=49
    17
    13
 
followed by 
 
 797  3299 cu=4096
    787
 227   773 cu=1000
    223    cu=343
     61
     59   

  Posted by Charlie on 2010-01-06 15:44:13
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 (7)
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