Daydream
A program is one number. It prints a sequence its author saw in a dream.
Hakerh400, 2022 · Turing complete: no · ●○○ easy · esolangs.org
Tested with 2 known programs · Test method
Run it
The idea
Hakerh400 found Daydream in 2022, as the specification puts it, rather than invented it. The author saw the specification in a dream and wrote it down even though the language is useless. The whole source is one natural number n, and the output is the first n terms of one fixed sequence. Input is ignored.
The machine
The sequence starts with 1. Term k is the sum of every earlier term that k does not divide.
| Term | Earlier terms that count | Value |
|---|---|---|
| 0 | none, it is 1 by definition | 1 |
| 1 | none, 1 divides everything | 0 |
| 2 | 1, as 2 divides 0 | 1 |
| 8 | 1, 1, 2 and 4 | 8 |
| 9 | all but 0 | 72 |
From term 2 to term 7 only the 0 is left out, so each term is the sum of all the ones before it and the sequence doubles. Term 8 drops back because 8, 16 and 32 are multiples of 8. The specification says 72 is the first positive term that is not a power of two. The terms are printed with a space between them and a line feed at the end, as the Haskell does it.
Example
The first line gives the ten terms the specification lists.
The first line gives the ten terms the specification lists. Term 12 falls back to 72, because 12 divides 72, 144 and 288 and leaves only 1, 1, 2, 4, 8, 16, 32 and 8.
Further
Ideas it shows
See also
Also in Jokes
Write your own in Run Convert a program from Daydream
Implementation
JavaScript interpreter, source and command line
A JavaScript interpreter, used in the browser and on the command line. Id: daydream.
Command line
shib run daydream -e '10'shib manual daydreamSource
- Module
langs/wiki/ports.js- Interpreter
langs/wiki/daydream.js
Docs: Kernel instructions · The .shib format · Command line · Adding a language
Source esolangs.org (CC0) · Edit on esolangs.org