Anti-primes: Difference between revisions
→{{header|Tiny BASIC}}: Optimized the "Count divisors" subroutine to accelerate.
(→{{header|Tiny BASIC}}: Optimized the "Count divisors" subroutine to accelerate.) |
|||
Line 835:
==={{header|Tiny BASIC}}===
{{works with|TinyBasic}}
<syntaxhighlight lang="basic">100
▲106 LET H=F
▲109 LET N=N+1
150 GOSUB 200▼
290 REM Search next anti-prime
151 IF F>H THEN RETURN▼
▲152 LET N=N+1
153 GOTO 150▼
201 LET C=1▼
390 REM Count divisors
205 IF N/C*C=N THEN LET F=F+1▼
208 RETURN▼
430 IF C*C>=N THEN GOTO 470
440 IF (N/C)*C=N THEN LET F=F+2
450 LET C=C+1
460 GOTO 430
</syntaxhighlight>
{{out}}
|