Shortest code to produce infinite non-periodic output
Python 2, 23 bytes
while 1:print id;id=id,
Try it online!
Prints
<built-in function id>
(<built-in function id>,)
((<built-in function id>,),)
(((<built-in function id>,),),)
((((<built-in function id>,),),),)
and so on. Starts with the built-in function id
, the shortest pre-initialized variable name, and repeatedly turns it into a tuple of itself.
In Python 3, this solution is one byte longer because of print()
, but the byte can be recovered from print
outputting None
:
while 1:id=print(id),id
or
while[print(id)]:id=id,
Hexagony, 2 bytes
(!
Try it online!
The unfolded source code looks like:
( !
. . .
. .
This just runs these two commands in a loop, which are decrement ((
) and print (!
). Hence, the output is:
-1-2-3-4-5-6-7-8-9-10-11-12...
We need to use decrement instead of increment to ensure that the program loops back to the first line (if the memory value was positive, Hexagony would loop between then second and third line, and end up in an infinite loop without doing anything).
Brachylog, 2 bytes
ẉ⊥
Try it online!
This prints all integers ordered by magnitude. This will never overflow and print already seen integers since Brachylog uses unbounded integers by default.
Explanation
ẉ Writeln: the Input is anything, so we label it implicitely to an integer and write it
⊥ False: backtrack and try another integer value for the Input