Hexadecimal Counter
Pure Bash, 26
Counts from 0x0 to 0x3F:
echo {0..3}{{0..9},{A..F}}
Try it online!
CJam, 21 14 bytes
A,_6,'Af++m*S*
Prints the numbers 00 to 9F.
Try it online in the CJam interpreter.
How it works
A, e# Push [0 ... 9].
_ e# Push a copy.
6, e# Push [0 ... 5].
'Af+ e# Add 'A' to each. This pushes "ABCDEF".
+ e# Concatenate. This pushes [0 ... 9 'A' ... 'F'].
m* e# Cartesian product. This pushes [[0 0] ... [9 'F'].
S* e# Join, separating by spaces.
Python 2, 52
a=0
for b in'0123456789ABCDEF'*4:print`a`+b;a+=b>'E'
Prints 00
to 3F
. Takes advantage of the fact that the first digit a
is always a number in this range. Loops through four cycles of the second digit b
, incrementing a
whenever the second digit is F
.
This is one char shorter than the more direct
for a in'0123':
for b in'0123456789ABCDEF':print a+b