Linked Questions
15 questions linked to/from Ah, why is there a bug in my program?
515
votes
969
answers
188k
views
"Hello, World!"
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
234
votes
366
answers
65k
views
Is this number a prime?
Believe it or not, we do not yet have a code golf challenge for a simple primality test. While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in ...
144
votes
566
answers
46k
views
Shortest infinite loop producing no output
Your task is to create the shortest infinite loop!
The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code ...
145
votes
333
answers
31k
views
Shortest code to produce infinite output
Write the shortest code you can that produces an infinite output.
That's all. You code will only be disqualified if it stops producing output at some point. As always in code golf, the shortest code ...
111
votes
286
answers
18k
views
Output with the same length as the code
In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules:
You may only ...
103
votes
298
answers
18k
views
Create output twice the length of the code
The Challenge
Write a complete program that writes twice as many bytes to standard output as the length of the program.
Rules
The program must write ASCII characters to the standard output.
The ...
150
votes
160
answers
22k
views
I double the source, you double the output!
Your task, if you wish to accept it, is to write a program that outputs a positive integer (higher than 0). The tricky part is that if I duplicate your source code, the output must be double the ...
57
votes
169
answers
17k
views
Output programming language name
Challenge:
In the programming language of your choice, take no input and output your programming language's name.
Fair enough, right?
Restrictions:
You can't use any character that is included in ...
32
votes
80
answers
4k
views
Swap the parity
Task
Given a positive integer n, output n+1 if n is odd, and output ...
52
votes
47
answers
16k
views
99 bugs in the code
99 bugs in the code
The adaption of "99 bottles of beer on the wall" for computer science where the bugs increase instead of the bottles decreasing is often re-posted around the internet. ...
33
votes
63
answers
6k
views
Integer Lists of Noah
Introduction:
I think we've all heard of it, but here a very brief summary: Noah gathered two of every species of animal on the planet, male and female, to save in his Ark during a great flood. The ...
38
votes
53
answers
3k
views
(RGS 1/5) Binary multiples [duplicate]
A binary multiple of a positive integer k is a positive integer n such that n is written ...
32
votes
51
answers
5k
views
How many petals around the rose
How many petals around the rose
How many petals around the rose is a dice game you can play with your friends. Similar to "can I join the music box", there is a person that knows how the ...
19
votes
56
answers
3k
views
Find the number of integers in the range from 1 to N that ends with 2
Task
As input you have:
a positive integer N
And you should output:
The number of integers in \$[1,N]\$ (an inclusive range) which end with the digit \$2\$ in ...
23
votes
36
answers
13k
views
Reverse Bit Order of 32-bit Integers
Write the shortest code to reverse the bit order of a 32-bit integer.
Rules:
Input is assumed to be a valid integer or string equivalent if your language doesn't support numerical values (e.g. ...