From our balcony far above the town, the lovely Inez and I admire the salsa dancers through a powerful spyglass; the air is heavy with the scent of verbena.
Speaking alphametically, let 100*LENS/SALSA=IN.VERVEINVERVEIN...etc.
INEZ is indubitably prime.
What is the numeric value of CARNAVAL?
10 dim Used(9)
20 point 5
30
40 for L=1 to 9
50 :if Used(L)=0 then
60 :Used(L)=1
70 :for S=1 to 9
80 :if Used(S)=0 then
90 :Used(S)=1
100 :for E=0 to 9
110 :if Used(E)=0 then
120 :Used(E)=1
130 :for N=0 to 9
140 :if Used(N)=0 then
150 :Used(N)=1
160 :Lens=L*1000+E*100+N*10+S
170 :for A=0 to 9
180 :if Used(A)=0 then
190 :Used(A)=1
200 :Salsa=S*10010+A*1001+L*100
210 :Vlu=100*Lens/Salsa
220 :if Vlu>10 and Vlu<99 then
230 :Vls=cutspc(str(Vlu))
240 :if val(mid(Vls,2,1))=N and len(Vls)>10 then
250 :I=val(left(Vls,1))
260 :if Used(I)=0 then
270 :Used(I)=1
280 :V=val(mid(Vls,4,1))
290 :if Used(V)=0 then
300 :Used(V)=1
310 :if val(mid(Vls,5,1))=E and val(mid(Vls,7,1))=V then
320 :R=val(mid(Vls,6,1))
330 :if Used(R)=0 then
340 :Used(R)=1
350 :Inez=nxtprm(I*1000+N*100+E*10)
360 :Lst=Inez+9
370 :while Inez<=Lst
380 :Z=Inez @ 10
390 :if Used(Z)=0 then
395 :Used(Z)=1
399 :C=-999
400 :for J=0 to 9
410 :if Used(J)=0 then C=J:endif
420 :next J
425 :print Lens;Salsa;Vlu,Inez
430 :print C;A;R;N;A;V;A;L
435 :Used(Z)=0
440 :endif
450 :Inez=nxtprm(Inez)
460 :wend
470 :Used(R)=0
480 :endif
490 :endif
500 :Used(V)=0
510 :endif
520 :Used(I)=0
530 :endif
540 :endif
550 :endif
560 :Used(A)=0
570 :endif
580 :next
590 :Used(N)=0
600 :endif
610 :next
620 :Used(E)=0
630 :endif
640 :next
650 :Used(S)=0
660 :endif
670 :next
680 :Used(L)=0
690 :endif
700 next
finds
LENS SALSA IN.VERVEINVERVEIN... INEZ
8604 41841 20.563562056356205635620563 2069
7 1 3 0 1 5 1 8
C A R N A V A L
|
Posted by Charlie
on 2011-10-16 13:02:21 |