Count in octal: Difference between revisions

(→‎J: simplify)
 
(5 intermediate revisions by 5 users not shown)
Line 627:
12
...
</pre>
 
=={{header|Amazing Hopper}}==
<syntaxhighlight lang="c">
#include <basico.h>
 
algoritmo
x=0, tope=11
decimales '0'
iterar grupo ( ++x,#( x< tope ),\
x,":",justificar derecha ( 5, x ---mostrar como octal--- ),\
NL, imprimir, cuando( #(x==10)){ \
"...\n...\n",x=4294967284, tope=4294967295} )
terminar
</syntaxhighlight>
{{out}}
<pre>
0: 0
1: 1
2: 2
3: 3
4: 4
5: 5
6: 6
7: 7
8: 10
9: 11
10: 12
...
...
4294967285: 37777777765
4294967286: 37777777766
4294967287: 37777777767
4294967288: 37777777770
4294967289: 37777777771
4294967290: 37777777772
4294967291: 37777777773
4294967292: 37777777774
4294967293: 37777777775
4294967294: 37777777776
 
</pre>
 
Line 978 ⟶ 1,019:
Local (2) ' digit C@ and string D@
' initialize, save sign
d@ := Dup("") : Push a@ < 0 : a@ = Abs(a@)
Do
Line 2,011 ⟶ 2,052:
 
=={{header|langur}}==
We have to use an arbitrary limit for this.
 
We use the :8x interpolation modifier to create a string in base 8 (may use base 2 to 36).
Line 2,017 ⟶ 2,058:
<syntaxhighlight lang="langur">val .limit = 70000
 
for .i = 0; .i <=of .limit; .i += 1 {
writeln $"10x\.i; == 8x\.i:8x;"
}</syntaxhighlight>
Line 2,406 ⟶ 2,447:
0 (dup octal succ)
9.223e18 int times ; close to max int value</syntaxhighlight>
 
=={{header|MiniScript}}==
<syntaxhighlight lang="miniscript">
toOctal = function(n)
result = ""
while n != 0
octet = n % 8
n = floor(n / 8)
result = octet + result
end while
return result
end function
 
maxnum = 10 ^ 15 - 1
i = 0
while i < maxnum
i += 1
print i + " = " + toOctal(i)
end while
</syntaxhighlight>
 
=={{header|МК-61/52}}==
Line 3,134 ⟶ 3,195:
 
=={{header|Python}}==
===Python2===
<syntaxhighlight lang="python">import sys
for n in xrange(sys.maxint):
print oct(n)</syntaxhighlight>
===Python3===
<syntaxhighlight lang="python">
# Python3 count_in_oct.py by Xing216
import sys
for n in range(sys.maxsize):
print(oct(n))
</syntaxhighlight>
 
=={{header|QB64}}==
Line 3,783 ⟶ 3,852:
=={{header|Wren}}==
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Conv
 
var i = 0
890

edits