John Seager submissions 5
5a AND 5b from TI*MES
ISSUE 29- 90q2 -
"Rambles for Times
July 1990"
99 REM John Seager
100 !ANSWER TO TEST5/A
110 CALL CLEAR :: NUM$="1176
49" :: DISPLAY AT(1,1):"7 TO
THE POWER OF"
120 FOR POWER=7 TO 300 :: DI
S$=NUM$ :: NUM$="" :: CARRY,
COUNT,SEVENS=0
130 FOR J=LEN(DIS$) TO 1 STE
P -1 :: NEWNUM=(VAL(SEG$(DIS
$,J,1))*7)+CARRY :: CARRY= I
NT(NEWNUM/10)
140 IF NEWNUM-CARRY*10<>7 TH
EN COUNT=0 ELSE COUNT=COUNT+
1
150 SEVENS=MAX(COUNT,SEVENS)
:: NUM$=STR$(NEWNUM-CARRY*1
0)&NUM$
160 NEXT J
170 IF CARRY>0 THEN NUM$=STR
$(CARRY)&NUM$ :: IF CARRY=7
THEN COUNT=COUNT+1
180 SEVENS=MAX(COUNT,SEVENS)
:: DISPLAY AT(1,19):STR$(PO
WER);"="; : : NUM$
190 IF SEVENS<>6 THEN 210 EL
SE DISPLAY AT(24,1):"ANY KEY
TO CONTINUE"
200 CALL KEY(0,K,S) :: IF S=
0 THEN 200 :: DISPLAY AT(24,
1)
210 NEXT POWER
220 REM WHY DOES THIS CRASH
WHEN THE NUMBER OF DIGITS EX
CEEDS 254...
99 REM FASTER WAY by John Se
ager
100 ! ANSWER TEST5/B
110 CALL CLEAR :: DIM ELEM(2
6) :: ELEM(0)=7 :: POWER,SS=
0 :: DISPLAY AT(1,1):"7 TO T
HE POWER OF"
120 ELM=SS :: SS,CARRY=0 ::
POWER=POWER+1
130 DIS$=STR$(ELEM(ELM)) ::
FOR I=ELM-1 TO 0 STEP -1 ::
DIS$=DIS$&RPT$("0",10-LEN(ST
R$(ELEM(I))))&STR$(ELEM(I))
:: NEXT I
140 DISPLAY AT(1,19):STR$(PO
WER);"="; : : DIS$
150 FOR I=6 TO LEN(DIS$)STEP
6 :: IF SEG$(DIS$,I,1)<>7 T
HEN 190
160 FOR J=I-5 TO I :: IF SEG
$(DIS$,J,6),."777777" THEN 1
80 ELSE DISPLAY AT(24,1):"AN
Y KEY TO CONTINUE"
170 CALL KEY(0,K,S) :: IF S=
0 THEN 170 :: DISPLAY AT(24,
1) :: J=1
180 NEXT J
190 NEXT I
200 ELEM(SS)=ELEM(SS)*7+CARR
Y :: IF ELEM(SS+1)=0 AND ELE
M(SS)<1.E+10 THEN 120
210 CARRY=INT(ELEM(SS)/1.E+1
0) :: ELEM(SS)=ELEM(SS)-CARR
Y*1.E+10
220 SS=SS+1 :: GOTO 200
Return to artic1.htm
John MURPHY PROGRAM from
DORTIG programmed May 1990:
This program was not
submitted and did not appear
in TI*MES but was found on a
disk after John died in 2009:
90 REM SAVE AS 'SS/TEST7'
100 REM ***S.SHAW TEST TI*M
ES ISS:28 P.19. Find the fir
st occurence of "777777" whe
n 7 is raised to the POWER o
f N??***
110 REM **This Program by J
. MURPHY for DOR-TIG 14 MAY
1990**
120 REM **INPUT NUMBER TO B
E RAISED TO POWER REQUIRED**
130 REM I Have started at N
UMBER^10 to stop running int
o "E"numbers
135 REM MAXIMUM LENGTH OF A
NSWER 254 NUMBERS
140 REM TO SEE NUMBER^ PRES
S SPACE BAR UNTIL PRINTED
150 CALL CLEAR :: NT=0
155 CALL SCREEN(5) :: FOR CO
=1 TO 9 :: CALL COLOR(CO,16,
5) :: NEXT CO
160 INPUT "NUMBER YOU REQUIR
E POWER OF(2 TO 9)":MT
162 IF MT>9 THEN 160
165 DISPLAY AT(12,3):"DO YOU
WISH TO FIND A SERIES OF NU
MBERS (EX:"777777"?) (Y/N)
" :: ACCEPT AT(15,7)VALIDAT
E(DIGIT,"YNyn")BEEP:FS$
170 IF FS$="N" OR FS$="n" TH
EN 185
180 INPUT "SERIES OF NUMBERS
YOU WISH TO FIND":TE$ :: GO
TO 190
185 NT=1
190 AD=0 :: X$="" :: P=10
210 DISPLAY AT(5,3):" WORK
ING HARD"
215 PRINT "PRESS ANY KEY AND
HOLD DOWN TO SEE PRESENT NU
MBER AND POWER"
220 TOT$=STR$(MT^10)
230 A$=TOT$ :: L=LEN(A$)
240 L1=INT(L/9)*9
250 AA$=SEG$(A$,(L-L1)+1,L1)
260 AAA$=SEG$(A$,1,L-L1)
270 FOR LE=L1-8 TO 1 STEP-9
280 C$=STR$(VAL(SEG$(AA$,LE,
9))*MT+AD)
290 IF LEN(C$)>8 THEN 400
300 ON 9-LEN(C$)GOTO 310,320
,330,340,350,360,370,380
310 OA$="0" :: GOTO 390
320 OA$="00" :: GOTO 390
330 OA$="000" :: GOTO 390
340 OA$="0000" :: GOTO 390
350 OA$="00000" :: GOTO 390
360 OA$="000000" :: GOTO 390
370 OA$="0000000" :: GOTO 39
0
380 OA$="00000000"
390 C$=OA$&C$
400 IF LEN(C$)=9 THEN 410 EL
SE 420
410 X$=C$&X$ :: AD=0 :: GOTO
440
420 AD=VAL(SEG$(C$,1,1))
430 X$=SEG$(C$,2,9)&X$
440 NEXT LE
450 LEE=LEN(AAA$)
460 IF LEE=0 THEN 530
470 FOR K=LEE TO 1 STEP-1
480 CC$=STR$(VAL(SEG$(AAA$,K
,1))*MT+AD) :: LCC=LEN(CC$)
:: IF LCC=1 OR K=1 THEN 490
ELSE 500
490 X$=CC$&X$ :: AD=0 :: GOT
O 520
500 AD=VAL(SEG$(CC$,1,1))
510 X$=SEG$(CC$,2,LCC-1)&X$
520 NEXT K :: GOTO 560
530 XX$=STR$(AD)
540 X$=XX$&X$
550 AD=0
560 TOT$=X$
570 CALL KEY(0,K,S) :: IF S=
0 THEN 585 ELSE 580
580 PRINT "NUMBER IS":TOT$:"
THIS IS ";MT;" TO POWER ";P+
1
585 IF NT>0 THEN 600
590 IF POS(TOT$,TE$,1)=0 THE
N 600 ELSE 610
600 X$="" :: P=P+1 :: GOTO 2
30
610 PRINT "FOUND IT!!!: NUMB
ER IS ";TOT$: :"THIS IS";MT;
;"^";P+1: :"SERIES REQUIRED
IS ";TE$
620 INPUT "ANOTHER NUMBER? (
Y/N)":AN$ :: IF AN$="Y" THEN
150
630 PRINT: :"BYE BYE FOR NOW
" :: FOR D=1 TO 200 :: NEXT
D
640 END
Return to artic1.htm
[ TI Book front page |
TI Resources Page
| PC99 Review
| PC99 Programs
]