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

Home > Numbers
Prime Cross Letters (Posted on 2004-08-24) Difficulty: 3 of 5
Each of the letters represent a different integer 0 TO 9 and each row and each column represent a nine digit prime number (18 in all).
C D A E I H D I C
B C C C A C D B F
B G H G D A H J D
F G E C B C A D A
I A D B J F E F C
A G I G F C A B D
D D I G E E A D A
F E E C F E H A C
C D C F D A F D F

See The Solution Submitted by Sandeep    
Rating: 3.0000 (4 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Hand-written program | Comment 5 of 6 |

The following UBASIC program was a helpful practice in writing UBASIC, especially the conversion of the Permute subroutine from QuickBasic:

    9   dim Row$(9)
   10   data "cdaeihdic","bcccacdbf","bghgdahjd","fgecbcada"""
   11   data "iadbjfefc","agigfcabd","ddigeeada","feecfehac","cdcfdafdf"""
   12   for I=1 to 9:read Row$(I):print Row$(I):next
   15   Asgn$="abcdefghij":H$=Asgn$
   20   repeat
   29      Good=1
   30      for R=1 to 9
   35        RVal=0
   40        for C=1 to 9
   50          Ix=instr(Asgn$,mid(Row$(R),C,1))
   60          RVal=RVal*10+Ix-1
   70        next C
   75        if nxtprm(RVal-1)<>RVal then Good=0:cancel for:goto 100:else if R>7 then print R,Row$(R),RVal,Asgn$
   90      next R
  100   if R>4 then print R;
  101   if Good=1 then
  110   :print Asgn$,"*"
  130     :for C=1 to 9
  135     :RVal=0
  140     :for R=1 to 9
  150     :Ix=instr(Asgn$,mid(Row$(R),C,1))
  160     :RVal=RVal*10+Ix-1
  170     :next R
  175     :if nxtprm(RVal-1)<>RVal then Good=0:cancel for:goto 200
  190     :next C
  200   if Good=1 then print:print Asgn$
  770   Cpr$=Asgn$
  780   gosub *Permute(&Asgn$)
  785   if left(Asgn$,2)<>left(Cpr$,2) then print Asgn$;" ";
  790   until H$=Asgn$
  799   end
  800 
  900   *Permute(&A$)
  920   local I,J,X$,Fl
 1100     X$=""
 1200     for I=len(A$) to 1 step -1
 1300      L$=X$
 1400      X$=mid(A$,I,1)
 1500      if X$<L$ then cancel for:goto *Outta
 1600     next
 1700   *Outta
 1800     if I=0 then
 1900      :for J=1 to len(A$)\2
 2000      :X$=mid(A$,J,1)
 2100      :mid(A$,J,1)=mid(A$,len(A$)-J+1,1)
 2200      :mid(A$,len(A$)-J+1,1)=X$
 2300      :next
 2400     :else
 2500      :for J=len(A$) to I+1 step -1
 2600      :if mid(A$,J,1)>X$ then cancel for:goto 2800:endif
 2700      :next
 2800      :mid(A$,I,1)=mid(A$,J,1)
 2900      :mid(A$,J,1)=X$
 3000      :for J=1 to (len(A$)-I)\2
 3100      :X$=mid(A$,I+J,1)
 3200      :mid(A$,I+J,1)=mid(A$,len(A$)-J+1,1)
 3300      :mid(A$,len(A$)-J+1,1)=X$
 3400      :next
 3600    return

The program found gciaejbdhf as the order of letters from 0 to 9, agreeing with Oskar's answer.


  Posted by Charlie on 2004-08-24 08:57:18
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 (12)
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