Erdős-primes: Difference between revisions

m
→‎{{header|Tiny BASIC}}: The variable E is not used. Removed line with E = ...
(→‎{{header|Tiny BASIC}}: Simplified and corrected. K! is calculated from (K - 1)!, not from the beginning. Now, there are displayed all 25 Erdős primes smaller than 2500 (previously, only 22).)
m (→‎{{header|Tiny BASIC}}: The variable E is not used. Removed line with E = ...)
Line 287:
Can't manage the stretch goal because integers are limited to signed 16 bit.
{{works with|TinyBasic}}
(Tiny BASICs other than Tom Pittman's) TinyBasic usesuse <code>;,</code> instead of <code>,;</code> for string concatenation in <code>PRINT</code>.
<syntaxhighlight lang="basic">10 REM Erdős-primes
20 LET P = 1
Line 302:
130 LET F = F * K
140 LET Z = P - F
150 IF Z < 0 THEN GOTO 200190
160 GOSUB 1000
170 IF A = 1 THEN LETGOTO E = 040
180 IF A = 1 THEN GOTO 40110
190 GOTOLET 110C = C + 1
200 LETIF CP =< 2500 THEN PRINT C; " +"; 1P
210 IF P <> 2500 THEN PRINT C, " ", PEND
230220 GOTO 40
220 IF P > 2500 THEN END
230 GOTO 40
 
990 REM primality of Z by trial division, result is in A
1000 LET Y = 1
512

edits