| Bytes | Lang | Time | Link |
|---|---|---|---|
| 016 | Haskell | 250616T084815Z | Ibozz91 |
| 1022 | QOOOOKALAN | 250615T192033Z | QOO-OOKA |
| 005 | APL Dyalog Classic | 231208T195513Z | Tbw |
| 003 | 05AB1E | 231211T084447Z | Kevin Cr |
| 010 | APL+WIN | 231208T182439Z | Graham |
| 175 | Vyxal H | 231209T203018Z | pacman25 |
| 006 | GolfScript | 231209T172600Z | noodle p |
| 017 | /// | 231209T165123Z | m90 |
| 023 | brainfuck | 231209T162812Z | m90 |
| 006 | Charcoal | 231208T220847Z | Neil |
| 002 | Jelly | 231208T175413Z | Jonathan |
| 041 | C | 231208T180701Z | segfault |
| 006 | Jelly | 231208T175404Z | hyperneu |
QOO-OOKALAN, 10/22 bytes
For the 100-tines repeating 1s (10 bytes):
out'1'*100
For real first 100 digits (22 bytes):
='';=+str(n)@1>100;out
Yes, QOO-OOKALAN allows to ommit values for use a system register value! (Read wiki in the link)
APL (Dyalog Classic), 5 bytes
100⍴1
Prints 1, one hundred times. Similar approach to @Jonathan Allan and others. First appears as
1111111111111111111111111111111111111111111111111 #fifty-one 1s
11111111111111111111111111111111111111111111111(12)
Index is \$51\cdot\frac{10^{51}-1}{9}+ \sum_{n=1}^{50}(9n \cdot 10^{n}) = \frac{5}{9}(10^{53}-1)-4\$. Explicitly, this is \$55555555555555555555555555555555555555555555555555551\$ (fifty-one 5s and one 1).
7 bytes
If we want to print as a string rather than a list.
100⍴'1'
05AB1E, 5 3 bytes
1т×
-2 bytes porting @Tbw's APL answer.
Outputs at 0-based index \$55555555555555555555555555555555555555555555555555551\$.
Original 5 bytes answer(s):
Y55ŸJ- Outputs at 0-based index \$1\$ - Try it online;T59ŸJ- Outputs at 0-based index \$9\$ - Try it online;46₃ŸJ- Outputs at 0-based index \$81\$ - Try it online.
Here also the program with an infinite list of all valid outputs:
∞Sü100J
Explanation:
1т # Push 1; Push 100
× # Pop both, and push a string of 100 1s
# (which is output implicitly as result)
Y55 # Push 2; Push 55
Ÿ # Pop both, and push a list in the range [2,55]
J # Join the list together to a single string
# (which is output implicitly as result)
T59 # Push 10; Push 59
ŸJ # Same as above
46₃ # Push 46; Push 95
ŸJ # Same as above
∞ # Push an infinite positive list: [1,2,3,...]
S # Convert it to a flattened list of digits
ü100 # Pop and push a list of all overlapping lists of 100 digits
J # Join each inner list of digits together to a string
# (after which this infinite list is output implicitly)
APL+WIN, 11 10 bytes
i byte saved thank to Tbw
A function taking no arguments with output from index 2 with index origin = 1
1↓⊃,/⍕¨⍳55
GolfScript, 6 bytes
55,(;5
Prints the first 100 digits.
55, # the list 0..55
(; # drop the 0
5 # push 5 to the stack
# the stack is implicitly printed without separator
Alternatively, this one prints a hundred 1s:
GolfScript, 6 bytes
1+100*
Gets "1" by appending 1 to the implicit empty input, then repeats it 100 times.
///, 17 bytes
/10/00000001/1100
Outputs 98 0s followed by 2 1s, which appears (in 1[000...0001 1]000...0002) at index 98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888990.
The replacement multiplies the number of 0s by 7 as they move across each 1.
Some alternative solutions, of the same length:
/10/0001/10010110
Outputs 96 0s followed by 4 1s.
/10/00001/0110010
Outputs 97 0s followed by 3 1s.
brainfuck, 23 bytes
-[----->+>+<<]>-[->..<]
Outputs 100 3s, which appears at index 16888888888888888888888888888888888888888888888888872.
This program first obtains the value 51 (which is the ASCII code of 3), calculating it as 255/5, in two cells. It then decrements one of those cells to 50, and then uses it as a counter for a loop in which each iteration outputs the other cell's value twice.
Charcoal, 6 bytes
⭆⁵⁰⁺χι
Try it online! Link is to verbose version of code. Starts at index 9. Explanation: Loops over the first 50 integers adding 10 to each, then joins everything together.
Alternative version, also 6 bytes:
⪫…χ⁶⁰ω
Try it online! Link is to verbose version of code. Starts at index 9. Explanation: Lists the integers from 10 to 60, then joins everything together.
Alternatively, starting at index 1, also for 6 bytes:
⭆⁵⁴⁺²ι
Try it online! Link is to verbose version of code. Explanation: Loops over the first 54 integers adding 2 to each, then joins everything together.
Boring 4-byte solution:
”);e
Try it online! Link is to verbose version of code. Starts at index 988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888890. Explanation: Compressed string of 100 0s.
Slightly less boring 5-byte solution:
IXφ³³
Try it online! Link is to verbose version of code. Starts at index 98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889. Explanation: Calculates 1000³³.
Jelly, 4 3 2 bytes
³Ṭ
A full program that accepts no arguments and prints a list of one hundred consecutive places starting at the 0-indexed index (you may need to scroll):
$$98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888890$$
How?
By definition, Champernowne's constant's decimal places are the concatenation of the natural numbers, so \$10^{99}\$, the first number with \$100\$ decimal digits, appears.
The index of \$N = 10^{99}\$ may be calculated like so:
$$d = \text{digit_length}(N) = \lfloor log_{10}(N) \rfloor + 1$$ $$\text{index} = d \times N - \frac{10^{d}-1}{9}$$ $$= 100 \times 10^{99}-\frac{10^{100}-1}{9}$$ $$= 10^{101}-\frac{10^{100}-1}{9}$$ $$=98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889$$
The next digit of Champernowne's constant after the last zero of \$N\$ is the first digit of \$N+1\$ which is \$1\$, so let's get the trailing \$99\$ zeros of \$N\$ and a \$1\$...
³Ṭ - Main Link: no arguments
³ - 100
Ṭ - untruth -> [0,0,0,...,1] (99 zeros followed by a one)
- implicit print
Original @ 4 bytes:
55ḊV
A full program that accepts no arguments and prints the 2nd to 101st decimal places.
How?
55ḊV - Main Link: no arguments
55 - fifty-five
Ḋ - dequeue -> [2,3,4,...,54,55]
V - evaluate as Jelly code -> (integer) 234...5455
- implicit print
C, 41 bytes
main(i){for(i=9;i++<59;)printf("%d",i);}
Goes through numbers 10 to 59 (indexes 9 to 108), printing exactly 100 digits (without a newline).
C, 28 bytes
main(){printf("1%099d",0);}
Inspired by Jonathan Allan's solution, just prints 10^99, starting at index 98888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888889 (if my short Python script did not fail me :p):
n = 0
for i in range(1, 100):
n = n + 9 * pow(10, i - 1) * i
print(n)
Jelly, 6 bytes
2r55DF
Starts at index 1 (digit 2 in the number 2). Range from 2 to 55 and then the decimal representation of each, then flattened.