Gapful numbers: Difference between revisions

Content added Content deleted
(Applesoft BASIC)
Line 215: Line 215:
1.0E+9 1.000000001E+9 1.000000005E+9 1.000000008E+9 1.00000001E+9 1.000000016E+9 1.00000002E+9 1.000000027E+9 1.00000003E+9 1.000000032E+9"</lang>
1.0E+9 1.000000001E+9 1.000000005E+9 1.000000008E+9 1.00000001E+9 1.000000016E+9 1.00000002E+9 1.000000027E+9 1.00000003E+9 1.000000032E+9"</lang>


=={{header|Applesoft BASIC}}==
{{trans|C}}
Numbers are printed digit by digit so that we can see what they actually are because large numbers would normally be printed in scientific notation.
<lang gwbasic> 100 START = 100
110 COUNT = 30
120 GOSUB 230"GENERATE GAPS"
130 PRINT
140 START = 1000000
150 COUNT = 15
160 GOSUB 230"GENERATE GAPS"
170 PRINT
180 START = 1000000000
190 COUNT = 15
200 GOSUB 230"GENERATE GAPS"
210 PRINT
220 END
230 GOSUB 340"PRINT START"
240 PRINT " :"M$
250 LET C = 0
260 FOR START = START TO 1E38
270 LET I$ = STR$ (START)
280 LET N = VAL ( LEFT$ (I$,1) + STR$ (START - INT (START / B) * B))
290 LET GAPFUL = START - INT (START / N) * N = 0
300 IF GAPFUL THEN GOSUB 370"PRINT GAPFUL"
310 IF C = COUNT THEN RETURN
320 NEXT START
330 STOP
340 LET M$ = CHR$ (13)
350 PRINT M$"FIRST "COUNT" ";
360 PRINT "GAPFUL NUMBERS >=";
370 LET C = C + 1
380 LET B = 10
390 LET P$ = ""
400 FOR P = START TO 0 STEP 0
410 LET Q = INT (P / B)
420 LET P$ = STR$ (P - Q * B) + P$
430 LET P = Q
440 NEXT P
450 PRINT MID$(M$ + " " + P$, 2 - (POS(0) + LEN(P$) + 1 > PEEK(33))) ;
460 RETURN</lang>
=={{header|Arturo}}==
=={{header|Arturo}}==