Hot answers tagged

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 ...
Dennis's user avatar
  • 210k
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 ...
Martin Ender's user avatar
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) ...
ETHproductions's user avatar
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 ...
Martin Ender's user avatar
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. ...
Robin Ryder's user avatar
  • 15.5k
138 votes

Calculate the number of primes up to n

C, 0.026119s (Mar 12 2016) ...
Dennis's user avatar
  • 210k
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, ...
xnor's user avatar
  • 144k
100 votes
Accepted

The Versatile Integer Printer

30 languages, 248 bytes, \$\frac {248} {30^3} = 0.009185\$ ...
Sp3000's user avatar
  • 61.7k
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: ...
Digital Trauma's user avatar
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. >&...
Sp3000's user avatar
  • 61.7k
93 votes

How high can you count?

Jelly, 47 integers, 519 bytes ...
Dennis's user avatar
  • 210k
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 ...
Deadcode's user avatar
  • 11.5k
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 ...
Tom Carpenter's user avatar
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.
xsot's user avatar
  • 5,469
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 ...
Neil's user avatar
  • 166k
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{...
Lynn's user avatar
  • 68.1k
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 ...
Mr. Xcoder's user avatar
  • 42.3k
66 votes

Count up forever

Labyrinth, 5 bytes ): \! ♫ The IP in the code goes round and round ♫ Relevant instructions: ...
Sp3000's user avatar
  • 61.7k
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 ...
totallyhuman's user avatar
  • 16.3k
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 ...
Digital Trauma's user avatar
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 ...
Dominic van Essen's user avatar
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 ...
NinjaBearMonkey's user avatar
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 ...
Wheat Wizard's user avatar
  • 96.6k
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 ...
randomra's user avatar
  • 20.8k
54 votes

Count all possible Tweets

Emotion, 17 bytes 😍😃💁🧟🤯😃😧😍😄🤶🙆🙆😬🏃🧛😧🤠 Explanation ...
Quantum64's user avatar
  • 1,051
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. ...
H.PWiz's user avatar
  • 11.6k
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 ...
Martin Ender's user avatar
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 ...
xnor's user avatar
  • 144k
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.
Jim's user avatar
  • 1,512

Only top scored, non community-wiki answers of a minimum length are eligible