# Questions tagged [code-golf]

Code-golf is a competition to solve a particular problem in the fewest bytes of source code.

11,276 questions
Filter by
Sorted by
Tagged with
438 views

### It's Just Rocket Science

Write a program/function that finds the amount of fuel needed to escape Earth's gravity well given the exhaust velocity of the fuel and the amount of mass to transport using the Tsiolkovsky rocket ...
2k views

### Rotational Average

Given an input integer n >= 10, output the average of all deduplicated rotations of the integer. For example, for input 123, ...
351 views

### Create a nibble shorthand

I recently stumbled across this image on wikimedia commons. It's a little bit of an information overload at first, but after examining it a bit it shows an interesting number system for writing ...
2k views

### Anti-divisors of a number

Given a positive integer n, output all of its anti-divisors in any order. From OEIS A006272: Anti-divisors are the numbers that do not divide a number by the ...
44k 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 ...
8k views

### Halloween Golf: The 2spooky4me Challenge!

A current internet meme is to type 2spooky4me, with a second person typing 3spooky5me, following the (n)spooky(n+2)me pattern. Your mission is to implement this ...
1k views

### Carryless factors

Carryless multiplication is an operation similar to binary long multiplication, but with XOR instead of addition: ...
461 views

### Count the number of compositions of $n$ in which the greatest part is odd

A composition of an integer $n$ is a representation of $n$ as a sum of positive integers. For example the eight compositions of 4 are as follows: ...
2k views

### Mathematical Combination

Write a program that takes an input such as: n,k which then computes: $$\binom n k = \frac {n!} {k!(n-k)!}$$ and then prints the result. A numerical example: ...
990 views

2k views

### Polyglot Quiz (Cops' thread)

This is the cops' thread of a cops-and-robbers challenge. The robbers' thread can be found here In this challenge as a cop you will choose two programming languages A and B, as well as a non-empty ...
3k views

### An Ant on a Cube

An ant walks along the edges (not faces) of a wireframe cube. Each vertex it encounters presents it with a fork from which two new edges branch off. The ant chooses which way to turn -- ...
2k views

### Sample integers that sum to one hundred

Given a positive integer n, randomly output n non negative integers that sum to one hundred. n will be at most 200. The output should be present as a list of integers (not sorted). Your random sample ...