Tau number: Difference between revisions
Content added Content deleted
(Added Chipmunk Basic, GW-BASIC, and MSX Basic) |
imported>Chinhouse No edit summary |
||
Line 1,715: | Line 1,715: | ||
{{out}} |
{{out}} |
||
<pre>{1,2,8,9,12,18,24,36,40,56,60,72,80,84,88,96,104,108,128,132,136,152,156,180,184,204,225,228,232,240,248,252,276,288,296,328,344,348,360,372,376,384,396,424,441,444,448,450,468,472,480,488,492,504,516,536,560,564,568,584,600,612,625,632,636,640,664,672,684,708,712,720,732,776,792,804,808,824,828,852,856,864,872,876,880,882,896,904,936,948,972,996,1016,1040,1044,1048,1056,1068,1089,1096}</pre> |
<pre>{1,2,8,9,12,18,24,36,40,56,60,72,80,84,88,96,104,108,128,132,136,152,156,180,184,204,225,228,232,240,248,252,276,288,296,328,344,348,360,372,376,384,396,424,441,444,448,450,468,472,480,488,492,504,516,536,560,564,568,584,600,612,625,632,636,640,664,672,684,708,712,720,732,776,792,804,808,824,828,852,856,864,872,876,880,882,896,904,936,948,972,996,1016,1040,1044,1048,1056,1068,1089,1096}</pre> |
||
=={{header|MiniScript}}== |
|||
<syntaxhighlight lang="miniscript"> |
|||
isTauNumber = function(n) |
|||
ans = 0 |
|||
i = 1 |
|||
while i * i <= n |
|||
if n % i == 0 then |
|||
ans += 1 |
|||
j = floor(n / i) |
|||
if j != i then ans += 1 |
|||
end if |
|||
i += 1 |
|||
end while |
|||
return (n % ans) == 0 |
|||
end function |
|||
tauNums = [] |
|||
i = 1 |
|||
while tauNums.len < 100 |
|||
if isTauNumber(i) then tauNums.push(i) |
|||
i += 1 |
|||
end while |
|||
print tauNums.join(", ") |
|||
</syntaxhighlight> |
|||
{{out}} |
|||
<pre> |
|||
1, 2, 8, 9, 12, 18, 24, 36, 40, 56, 60, 72, 80, 84, 88, 96, 104, 108, 128, 132, 136, 152, 156, 180, 184, 204, 225, 228, 232, 240, 248, 252, 276, 288, 296, 328, 344, 348, 360, 372, 376, 384, 396, 424, 441, 444, 448, 450, 468, 472, 480, 488, 492, 504, 516, 536, 560, 564, 568, 584, 600, 612, 625, 632, 636, 640, 664, 672, 684, 708, 712, 720, 732, 776, 792, 804, 808, 824, 828, 852, 856, 864, 872, 876, 880, 882, 896, 904, 936, 948, 972, 996, 1016, 1040, 1044, 1048, 1056, 1068, 1089, 1096 |
|||
</pre> |
|||
=={{header|Modula-2}}== |
=={{header|Modula-2}}== |