224
votes
Hyperprogramming: N+N, N×N, N^N all in one
Jelly, 12 bytes
N+N
“(ẹ+)‘FQṖṪỌv
Try it online!
N×N
““((ẹẹ++))‘‘FFQQṖṖṪṪỌỌvv
Try it online!
N^N
...
206
votes
What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?
Retina, score 1
The empty program counts the number of matches of the empty regex in the input (which is the empty string). That's exactly 1 match, so it prints ...
157
votes
How high can you count?
JavaScript (ES7), score 17, 176 bytes
They said it couldn't be done, so I did it :D (thanks to a lot of help from @FullDecent)
...
153
votes
The Versatile Integer Printer
15 languages, 68 66 65 bytes / 15^3 = 0.019...
Retina, Starry, Prelude, ETA, Axo, Labyrinth, Hexagony, Foo, Brian & Chuck, Gol><>, evil, Whitespace, Fission, ><> and GolfScript.
After a ...
141
votes
Accepted
Print 0 to 100 without 1-9 characters
R, 9 bytes
F:volcano
Try it online!
The sequence operator : coerces its arguments to integers. ...
138
votes
122
votes
Golf a transcendental number
Python, 3 bytes
min
Try it online!
Takes a number string, outputs its smallest digit as a smallest character. For example, ...
100
votes
Accepted
97
votes
How even is a number?
x86_64 machine code, 4 bytes
The BSF (bit scan forward) instruction does exactly this!
0x0f 0xbc 0xc7 0xc3
In gcc-style assembly, this is:
...
93
votes
Hyperprogramming: N+N, N×N, N^N all in one
><>, 41 bytes
\<
1:: :
&&* +
i*n n
c&
%:
4l
0(
.i
n}
&?
Try it online: N+N, N*N, N^N. Assumes that the STDIN input is exactly one char.
>&...
93
votes
79
votes
Shift right by half a bit
Regex (ECMAScript+(?*)), 1169 929 887 853 849 708 bytes
-141 bytes by using the second form of shortened division, where \$A^2 > C\$
Regex was never designed to ...
76
votes
What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?
Pyth, 10
T
First attempt at using Pyth. Having had the question clarified, it seems 10 will be the smallest number. In Pyth the letter T starts off as the number ...
76
votes
Print numbers from 1 to 10
C, 36 bytes
main(i){while(printf("%d ",i++)<3);}
This works because the loop terminates after the first 2 digit number.
75
votes
The first n numbers without consecutive equal binary digits
Python 2, 36 bytes
lambda n:[2**i*2/3for i in range(n)]
Try it online! Explanation: The binary representation of \$\frac{2}3\$ is ...
71
votes
Patience, young "Padovan"
Jelly, 10 bytes
9s3’Ẓæ*³FṀ
Try it online!
1-indexed. Computes the largest element of: $$\begin{bmatrix}0&0&1 \\ 1&0&1 \\ 0&1&0\end{...
70
votes
It was just a bug
Python 2, 59 57 56 55 bytes
i=8;exec"print(' '*abs(i)).join('1234567890');i-=1;"*17
Try it online!
@Leaky Nun helped golfing this a lot, @Praind ...
66
votes
Count up forever
Labyrinth, 5 bytes
):
\!
♫ The IP in the code goes round and round ♫
Relevant instructions:
...
66
votes
How high can you count?
brainfuck, score 2, 255 144 10 bytes
...Yeah, not the best idea since I only have 8 characters (tarpits gonna tarpit) to work with but let's see how much is possible. I think this is all that's ...
62
votes
What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?
bc, 10
A
Luckily, bc prints the result of the last expression by default. A is interpreted ...
62
votes
Increment The Time
Microsoft Excel, 9 bytes
=A1+"0:1"
Input is in cell A1.
Tested on my Mac (Excel for Mac version 16.53) and online at ...
58
votes
Print numbers from 1 to 10
HTML, 44 bytes
<ol><li><li><li><li><li><li><li><li><li><li>
This is longer than ...
58
votes
Reciprocal of a number (1/x)
Brain-Flak, 772 536 530 482 480 + 1 = 481 bytes
Since Brain-Flak does not support floating point numbers I had to use the -c flag in order input and output with ...
55
votes
Count up forever
><>, 8 bytes
01+:nao!
Steps:
Push 0 on the stack
Add 1 to the top stack element
Duplicate top stack element
Output the top of the stack as number
Output a ...
54
votes
53
votes
Is this number a prime?
Hexagony, 28 bytes
Since Etoplay absolutely trounced me on this question, I felt that I had to outgolf his only other answer.
...
52
votes
Output the sign
Retina, 9 bytes
[1-9].*
1
Try it online!
Replaces a non-zero digit and everything after it with 1. This leaves a potential ...
51
votes
Print all integers
Haskell, 19 bytes
do n<-[1..];[1-n,n]
Produces the infinite list [0,1,-1,2,-2,3,-3,4,-4,5,-5,6,-6,7,-7...
Haskell allows ...
51
votes
Sum of all integers from 1 to n
Pyth, 2 bytes
sS
Try it online! Implicit input. S is 1-indexed range, and s is the sum.
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
number × 1301code-golf × 1210
math × 296
sequence × 241
arithmetic × 151
integer × 116
string × 104
number-theory × 98
decision-problem × 95
array × 87
primes × 66
base-conversion × 55
code-challenge × 46
binary × 41
ascii-art × 35
kolmogorov-complexity × 32
combinatorics × 28
random × 23
fibonacci × 22
matrix × 21
restricted-source × 19
rational-numbers × 19
sorting × 18
permutations × 18
fastest-code × 17