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

Home > Numbers
Primed to Magic (Posted on 2010-05-18) Difficulty: 3 of 5

No Solution Yet Submitted by brianjn    
No Rating

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

   50         Lookfor=67
  100          dim Used(28)
  200          for P1=2 to 17
  300           Used(P1)=1
  400          for P3=P1+1 to 18
  500           Used(P3)=1
  600          for P7=P3+1 to 19
  700           Used(P7)=1
  800          for P9=P1+1 to 19
  900          if Used(P9)=0 then
 1000          :Used(P9)=1
 1100          :
 1200          :for P2=2 to 19
 1300           :if Used(P2)=0 then
 1400            :Used(P2)=1
 1500            :R1=prm(P1)+prm(P2)+prm(P3)
 1600            :if prmdiv(R1)=R1 then
 1700          :for P4=2 to 19
 1800           :if Used(P4)=0 then
 1900            :Used(P4)=1
 2000            :C1=prm(P1)+prm(P4)+prm(P7)
 2100            :if prmdiv(C1)=C1 then
 2200          :for P6=2 to 19
 2300           :if Used(P6)=0 then
 2400            :Used(P6)=1
 2500            :C3=prm(P3)+prm(P6)+prm(P9)
 2600            :if prmdiv(C3)=C3 then
 2700          :for P5=2 to 19
 2800           :if Used(P5)=0 then
 2900            :Used(P5)=1
 3000            :R2=prm(P4)+prm(P5)+prm(P6)
 3100            :D1=prm(P1)+prm(P5)+prm(P9)
 3200            :D2=prm(P3)+prm(P5)+prm(P7)
 3300            :if prmdiv(R2)=R2 and prmdiv(D1)=D1 and prmdiv(D2)=D2 then
 3400          :for P8=2 to 19
 3500           :if Used(P8)=0 then
 3600            :Used(P8)=1
 3700            :R3=prm(P7)+prm(P8)+prm(P9)
 3800            :C2=prm(P2)+prm(P5)+prm(P8)
 3900            :if prmdiv(R3)=R3 and prmdiv(C2)=C2 then
 3990            :if R1<=Lookfor and R2<=Lookfor and R3<=Lookfor and D1<=Lookfor and D2<=Lookfor then
 3991            :if C1<=Lookfor and C2<=Lookfor and C3<=Lookfor then
 3992            :if Used(fnPrmnum(R1))=0 and Used(fnPrmnum(R2))=0 and Used(fnPrmnum(R3))=0 and Used(fnPrmnum(C1))=0 and Used(fnPrmnum(C2))=0 and Used(fnPrmnum(C3))=0 and Used(fnPrmnum(D1))=0 and Used(fnPrmnum(D2))=0 then
 3995            :gosub *ChkGood
 3996            :if Good then
 4000             :print prm(P1);prm(P2);prm(P3)
 4100             :print prm(P4);prm(P5);prm(P6)
 4200             :print prm(P7);prm(P8);prm(P9)
 4210             :print R1;R2;R3,C1;C2;C3,D1;D2
 4300             :print
 4367            :endif
 4368            :endif
 4369            :endif
 4370            :endif
 4400            :endif
 4500            :Used(P8)=0
 4600           :endif
 4700          :next
 4800            :endif
 4900            :Used(P5)=0
 5000           :endif
 5100          :next
 5200            :endif
 5300            :Used(P6)=0
 5400           :endif
 5500          :next
 5600            :endif
 5700            :Used(P4)=0
 5800           :endif
 5900          :next
 6000            :endif
 6100            :Used(P2)=0
 6200           :endif
 6300          :next
 6400          :
 6500          :Used(P9)=0
 6600          :endif
 6700          next
 6800           Used(P7)=0
 6900          next
 7000           Used(P3)=0
 7100          next
 7200           Used(P1)=0
 7300          next
 9999   end
10000   fnPrmnum(P)
10010      local Ct
10020      Ct=0:Currprime=1
10030      while Currprime<P
10040          inc Ct
10050          Currprime=nxtprm(Currprime)
10060      wend
10070      return(Ct)
20000   *ChkGood
20010    Good=1
20020    if Used(fnPrmnum(R1)) or Used(fnPrmnum(R2)) or Used(fnPrmnum(R3)) then Good=0
20030    if Used(fnPrmnum(C1)) or Used(fnPrmnum(C2)) or Used(fnPrmnum(C3)) then Good=0
20040    if Used(fnPrmnum(D1)) or Used(fnPrmnum(D2)) then Good=0
20042    if Good=0 then return
20043    Good=0
20050    Used(fnPrmnum(R1))=1
20060    if Used(fnPrmnum(R2))=0 then
20065     :Used(fnPrmnum(R2))=1
20067    :if Used(fnPrmnum(R3))=0 then
20069     :Used(fnPrmnum(R3))=1
20070    :if Used(fnPrmnum(C1))=0 then
20075     :Used(fnPrmnum(C1))=1
20080    :if Used(fnPrmnum(C2))=0 then
20085     :Used(fnPrmnum(C2))=1
20090    :if Used(fnPrmnum(C3))=0 then
20095     :Used(fnPrmnum(C3))=1
20100    :if Used(fnPrmnum(D1))=0 then
20110     :Used(fnPrmnum(D1))=1
20120    :if Used(fnPrmnum(D2))=0 then
20130     :Good=1
20140    Used(fnPrmnum(R1))=0:Used(fnPrmnum(R2))=0:Used(fnPrmnum(R3))=0
20150    Used(fnPrmnum(C1))=0:Used(fnPrmnum(C2))=0:Used(fnPrmnum(C3))=0
20160    Used(fnPrmnum(D1))=0:Used(fnPrmnum(D2))=0
20170    return

The numbering of the primes is different from that of the puzzle array. P1 - P9 are the yellow 3x3 array itself, and the values kept are the ordinal of the prime, such as 1, 2, 3, 4, 5, ... for 2, 3, 5, 7, 11, ... respectively.

The Lookfor value of 67 was found by reducing it from higher values (starting at the 107 mentioned in the puzzle) after seeing many sets having lower maximum values, and, likewise, the limitations on the ordinal of the primes

run
 3  11  5
 37  17  13
 7  31  23
 19  67  61      47  59  41      43  29

 3  23  5
 41  7  11
 17  13  37
 31  59  67      61  43  53      47  29

 13  31  17
 11  3  5
 23  7  37
 61  19  67      47  41  59      53  43

OK

Rearranging the total digits around the square array:

              29
             
  3  11   5   19
 37  17  13   67
  7  31  23   61
 
 47  59  41   43
-------------------
              29
             
  3  23   5   31
 41   7  11   59
 17  13  37   67
 
 61  43  53   47
-------------------
              43
 13  31  17   61
 11   3   5   19
 23   7  37   67
 47  41  59   53  
 


Rotations and reflections were prevented by requiring, in the representation nomenclature of the original puzzle, P2 to be the lowest corner prime, and P2 < P4 < P10.

The given solutions include no prime higher than 67, which is the 19th prime. As 17 primes are used, only two are left out, one of which is, of course, 2 as that number's presence would upset the parity for at least two totals, making them even and therefore not prime, since they cannot also be just 2. Missing from the first set is 53; from the second, 19; and from the third, 29. The first set, therefore, has the lowest primes, since it has the highest missing prime.


  Posted by Charlie on 2010-05-18 17:52:21
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 (0)
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