Cullen and Woodall numbers: Difference between revisions
Content deleted Content added
add RPL |
Cullen and Woodall numbers in various dialects BASIC (Applesoft BASIC, Chipmunk Basic, GW-BASIC and MSX Basic) |
||
Line 192: | Line 192: | ||
=={{header|BASIC}}== |
=={{header|BASIC}}== |
||
==={{header|Applesoft BASIC}}=== |
|||
{{works with|Chipmunk Basic}} |
|||
{{trans|Chipmunk Basic}} |
|||
<syntaxhighlight lang="qbasic">10 REM Cullen and Woodall numbers |
|||
20 HOME : REM 20 CLS for Chipmunk Basic |
|||
30 PRINT "First 20 Cullen numbers:" |
|||
40 FOR n = 1 TO 20 |
|||
50 num = n*(2^n)+1 |
|||
60 PRINT INT(num);" "; |
|||
70 NEXT |
|||
80 PRINT : PRINT |
|||
90 PRINT "First 20 Woodall numbers:" |
|||
100 FOR n = 1 TO 20 |
|||
110 num = n*(2^n)-1 |
|||
120 PRINT INT(num);" "; |
|||
130 NEXT n |
|||
140 END</syntaxhighlight> |
|||
==={{header|BASIC256}}=== |
==={{header|BASIC256}}=== |
||
{{works with|Run BASIC}} |
{{works with|Run BASIC}} |
||
Line 214: | Line 232: | ||
{{out}} |
{{out}} |
||
<pre>Igual que la entrada de FreeBASIC.</pre> |
<pre>Igual que la entrada de FreeBASIC.</pre> |
||
==={{header|Chipmunk Basic}}=== |
|||
{{works with|Chipmunk Basic|3.6.4}} |
|||
{{works with|Applesoft BASIC}} |
|||
{{works with|MSX_BASIC}} |
|||
{{works with|PC-BASIC|any}} |
|||
{{works with|QBasic}} |
|||
{{trans|FreeBASIC}} |
|||
<syntaxhighlight lang="qbasic">10 REM Cullen and Woodall numbers |
|||
20 CLS : REM 20 HOME for Applesoft BASIC |
|||
30 PRINT "First 20 Cullen numbers:" |
|||
40 FOR n = 1 TO 20 |
|||
50 num = n*(2^n)+1 |
|||
60 PRINT INT(num);" "; |
|||
70 NEXT |
|||
80 PRINT : PRINT |
|||
90 PRINT "First 20 Woodall numbers:" |
|||
100 FOR n = 1 TO 20 |
|||
110 num = n*(2^n)-1 |
|||
120 PRINT INT(num);" "; |
|||
130 NEXT n |
|||
140 END</syntaxhighlight> |
|||
{{out}} |
|||
<pre>Same as FreeBASIC entry.</pre> |
|||
==={{header|FreeBASIC}}=== |
==={{header|FreeBASIC}}=== |
||
Line 260: | Line 302: | ||
{{out}} |
{{out}} |
||
<pre>Same as FreeBASIC entry.</pre> |
<pre>Same as FreeBASIC entry.</pre> |
||
==={{header|GW-BASIC}}=== |
|||
The [[#Chipmunk_Basic|Chipmunk Basic]] solution works without any changes. |
|||
==={{header|PureBasic}}=== |
==={{header|PureBasic}}=== |
||
Line 416: | Line 461: | ||
{{out}} |
{{out}} |
||
<pre>Igual que la entrada de FreeBASIC.</pre> |
<pre>Igual que la entrada de FreeBASIC.</pre> |
||
==={{header|MSX Basic}}=== |
|||
The [[#Chipmunk_Basic|Chipmunk Basic]] solution works without any changes. |
|||
==={{header|XBasic}}=== |
==={{header|XBasic}}=== |