Inconsummate numbers in base 10: Difference between revisions
Content added Content deleted
Not a robot (talk | contribs) (Add APL) |
Not a robot (talk | contribs) (Add BASIC) |
||
Line 269: | Line 269: | ||
491 492 493 494 497 498 516 521 522 527 |
491 492 493 494 497 498 516 521 522 527 |
||
The 1000th inconsummate number: 6996</pre> |
The 1000th inconsummate number: 6996</pre> |
||
=={{header|BASIC}}== |
|||
<syntaxhighlight lang="basic">10 DEFINT A-Z |
|||
20 M=999 |
|||
30 DIM C(M) |
|||
40 Z=M*9*(LEN(STR$(M))-1) |
|||
50 FOR I=10 TO Z |
|||
60 J=I:S=0 |
|||
70 S=S+J MOD 10:J=J\10:IF J GOTO 70 |
|||
80 IF I MOD S=0 THEN J=I\S:IF J<=M THEN C(J)=-1 |
|||
90 NEXT |
|||
100 J=0 |
|||
110 FOR I=10 TO M |
|||
120 IF J=50 THEN END |
|||
130 IF NOT C(I) THEN J=J+1:PRINT I, |
|||
140 NEXT</syntaxhighlight> |
|||
{{out}} |
|||
<pre> 62 63 65 75 84 |
|||
95 161 173 195 216 |
|||
261 266 272 276 326 |
|||
371 372 377 381 383 |
|||
386 387 395 411 416 |
|||
422 426 431 432 438 |
|||
441 443 461 466 471 |
|||
476 482 483 486 488 |
|||
491 492 493 494 497 |
|||
498 516 521 522 527</pre> |
|||
=={{header|FreeBASIC}}== |
=={{header|FreeBASIC}}== |