Erdős-primes: Difference between revisions

Content added Content deleted
(→‎{{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: Line 287:
Can't manage the stretch goal because integers are limited to signed 16 bit.
Can't manage the stretch goal because integers are limited to signed 16 bit.
{{works with|TinyBasic}}
{{works with|TinyBasic}}
(Tom Pittman's) TinyBasic uses <code>;</code> instead of <code>,</code> for string concatenation in <code>PRINT</code>.
Tiny BASICs other than Tom Pittman's TinyBasic use <code>,</code> instead of <code>;</code> for string concatenation in <code>PRINT</code>.
<syntaxhighlight lang="basic">10 REM Erdős-primes
<syntaxhighlight lang="basic">10 REM Erdős-primes
20 LET P = 1
20 LET P = 1
Line 302: Line 302:
130 LET F = F * K
130 LET F = F * K
140 LET Z = P - F
140 LET Z = P - F
150 IF Z < 0 THEN GOTO 200
150 IF Z < 0 THEN GOTO 190
160 GOSUB 1000
160 GOSUB 1000
170 IF A = 1 THEN LET E = 0
170 IF A = 1 THEN GOTO 40
180 IF A = 1 THEN GOTO 40
180 GOTO 110
190 GOTO 110
190 LET C = C + 1
200 LET C = C + 1
200 IF P < 2500 THEN PRINT C; " "; P
210 IF P < 2500 THEN PRINT C, " ", P
210 IF P > 2500 THEN END
220 GOTO 40
220 IF P > 2500 THEN END
230 GOTO 40

990 REM primality of Z by trial division, result is in A
990 REM primality of Z by trial division, result is in A
1000 LET Y = 1
1000 LET Y = 1