Linked Questions

14 votes
21 answers
2k views

Constructing Solar Panels from Squares

I'm designing a new space station for generic super-villain purposes (something something megalaser), but I'm having trouble designing the solar panels. My genius team of scientists can calculate ...
Mayube's user avatar
  • 11.6k
10 votes
35 answers
2k views

How long is the number in this base?

Given a positive integer \$n\$ and another positive integer \$b\$ (\$1 < b < 36\$), return the number of digits/length of \$n\$ in base \$b\$ ...
2x plus 1's user avatar
  • 133
33 votes
52 answers
3k views

Split a list at the second occurrence of the first element

Why should you golf in Haskell? Find out here. In that answer, Zgarb defines a task: Let's define a function f that splits a list at the second occurrence of the ...
caird coinheringaahin g's user avatar
12 votes
5 answers
369 views

Tips for restricted source in zsh

Adapted from tips for restricted-source in Python Just like code-golf, restricted-source pushes one to exploit quirks and hidden features of the zsh language. While we already have a place to collect ...
pxeger's user avatar
  • 23.7k
33 votes
17 answers
6k views

Is it a lobster number?

Introduction A "lobster number", by my own designation, is a number that contains within itself all of its prime factors. The "lobster" description was inspired by the recent ...
IronEagle's user avatar
  • 439
120 votes
19 answers
64k views

"Hello, World!" in zero lines of code

NPM's sloc is a moderately popular tool for counting source lines of code in a file. The tool will attempt to strip out both single and multiline comments and count the remaining lines in order to get ...
Sisyphus's user avatar
  • 14.8k
46 votes
15 answers
3k views

Tips for Creating/Maintaining a Golfing Language

Creating a golfing language can be hard. Let's help budding golfing language creators out and provide some helpful tips on how to create one. I'm looking for tips on: The design process ...
lyxal's user avatar
  • 33.3k
16 votes
20 answers
2k views

Produce a List of Rotonyms 1

Rotonyms 1 ROT13 ("rotate by 13 places") is a simple letter substitution cipher that replaces a letter with the 13th letter after it, in the alphabet. So, A ...
Umbrella's user avatar
  • 897
18 votes
15 answers
2k views

Golf the Chinese 9*9 multiple table

Output the following table: ...
l4m2's user avatar
  • 23.8k
73 votes
211 answers
18k views

The Programming Language Quiz, Mark II - Cops

A repost of this challenge. Meta discussion. Sandbox post. Body of the question similar to the original Robber's challenge This cops and robbers is now (08/03/2018) closed to further competing cop ...
caird coinheringaahin g's user avatar
22 votes
12 answers
3k views

Is it a substring of itself?

Given a string, return whether the string is a substring of the program's source code. Standard quine rules apply, meaning you cannot read your own source code. The length of the input is guaranteed ...
caird coinheringaahin g's user avatar
18 votes
22 answers
1k views

Output diagonal positions of me squared

Given a number n, Output an ordered list of 1-based indices falling on either of the diagonals of an n*n square matrix. ...
sergiol's user avatar
  • 3,396
19 votes
14 answers
2k views

Seeking Secret Swapping Sequences

This is a cops-and-robbers challenge, the robbers thread can be found here. Your task is to write some code that outputs an OEIS sequence, and contains the name of the sequence in the code (...
Wheat Wizard's user avatar
  • 98.5k
28 votes
8 answers
4k views

Err, Where am I?

Oh no! I'm trapped in a big forest (Okay, not really, but just assume it) and I don't know where I am! Thankfully, I brought my laptop. But when I searched 'Maps', It said 'No results', and I'm ...
Matthew Roh's user avatar
  • 5,347
23 votes
14 answers
3k views

Make a Bubble-wrap simulator

Bubble-wraps are maximum-level entertainment. Everyone can agree to that. Now, you will make even computers enjoy bubble-wraps. Specs You will be given two integers, w, and h.(each are responsively ...
Matthew Roh's user avatar
  • 5,347
17 votes
10 answers
1k views

Sign change, loop and display with minimal padding

Input: Two integers: one negative, one positive. Output: On the first line output lowest to highest. On the second line we've removed the highest and lowest numbers and sign-changed all individual ...
Kevin Cruijssen's user avatar
19 votes
29 answers
3k views

Do Matrix Multiplication!

In mathematics, matrix multiplication or the matrix product is a binary operation that produces a matrix from two matrices. The definition is motivated by linear equations and linear transformations ...
Oliver Ni's user avatar
  • 10.6k
49 votes
67 answers
6k views

Depalindromize this string!

Given a palindrome generated according to this challenge, depalindromize it. Test cases ...
Oliver Ni's user avatar
  • 10.6k
165 votes
128 answers
33k views

Trick or Treat polyglot

Since Halloween is coming up I thought I might start a fun little code golf challenge! The challenge is quite simple. You have to write a program that outputs either ...
BrainStone's user avatar
  • 1,531
26 votes
51 answers
2k views

Draw an alphabet party hat

Your task is to print this exact text: ...
Oliver Ni's user avatar
  • 10.6k
64 votes
153 answers
13k views

Draw an asterisk triangle

Inspired by a task for Programming 101, here's a challenge that hopefully isn't too easy (or a duplicate). Input: A positive integer n >= 1. Output: ...
Sickboy's user avatar
  • 1,205
28 votes
29 answers
3k views

Let's do the Wave!

Input: A string (the wave-snippet) with a length >= 2. A positive integer n >= 1. Output: We output a single-line wave. ...
Kevin Cruijssen's user avatar
24 votes
23 answers
5k views

How many times will a bell tower ring?

Introduction A bell tower will ring its bells every hour, n times, with n being the the current hour on a 12 hour clock. For ...
Shaun Wild's user avatar
  • 2,491
6 votes
13 answers
3k views

0.0000000000000000001

Notice the pattern in the below sequence: 0.1, 0.01, 0.001, 0.0001, 0.00001 and so on, until reaching 0.{one hundred zeros}1 Then, continued: ...
Buffer Over Read's user avatar
88 votes
28 answers
8k views

Bake a slice of Pi

Write a program or function that prints or outputs this exact text (consisting of 142 characters): ...
Copper's user avatar
  • 3,910
67 votes
165 answers
10k views

Print all integers

Write a program or function which will provably print all integers exactly once given infinite time and memory. Possible outputs could be: ...
Fatalize's user avatar
  • 38.7k
32 votes
23 answers
16k views

Draw an Empty Scrabble Board

A standard Scrabble board is a 15×15 grid of spaces to place letter tiles. Most of the spaces are blank but some are double word scores (pink), triple word scores (red), double letter scores (...
Calvin's Hobbies's user avatar
85 votes
218 answers
23k views

The Letter A without A

Your task is to display the letter "A" alone, without anything else, except any form of trailing newlines if you cannot avoid them, doing so in a program and/or snippet. Code that returns (instead of ...
Buffer Over Read's user avatar
30 votes
72 answers
3k views

A square of text

The Challenge Given a string, output the text in the shape of a square. You can assume that the text will always fit in a square, and that it will never be an empty string. You can also assume it ...
acrolith's user avatar
  • 3,888
121 votes
409 answers
30k views

Print a 10 by 10 grid of asterisks

Background This is a standard textbook example to demonstrate for loops. This is one of the first programs I learnt when I started learning programming ~10 years ago. Task You are to print this exact ...
Leaky Nun's user avatar
  • 49.7k
46 votes
11 answers
2k views

Run Stackylogic

Stackylogic is a logic-based programming language I made up that take in 0's and 1's for input and outputs a single ...
Calvin's Hobbies's user avatar
67 votes
235 answers
18k views

Add two numbers

Input: Two integers. Preferably decimal integers, but other forms of numbers can be used. These can be given to the code in standard input, as arguments to the program or function, or as a list. ...
anna328p's user avatar
  • 6,376
80 votes
94 answers
18k views

Golf all the 16 logic gates with 2 inputs and 1 output!

For example, the gate A and B is a logic gate with 2 inputs and 1 output. There are exactly 16 of them, because: each logic gate takes two inputs, which can be ...
Leaky Nun's user avatar
  • 49.7k
19 votes
13 answers
829 views

Tips for golfing in dc

What general tips do you have for golfing in dc? dc is a calculator utility for UNIX/Linux that predates the C language. I am interested in how to make my dc programs (calculations?) shorter. I'm ...
mriklojn's user avatar
  • 393
31 votes
27 answers
3k views

Palindromizing the strings

Introduction For the ones who don't know, a palindrome is when a string is equal to the string backwards (with exception to interpunction, spaces, etc.). An example of a palindrome is: ...
Adnan's user avatar
  • 44.4k
19 votes
8 answers
1k views

Hilbert-Curvify a Matrix

Inspired by this question Another way to unroll a 2D image into a 1D string is to use an Hilbert Curve. There are many version of this curve, depending on the number of iterations used while ...
WizardOfMenlo's user avatar
20 votes
18 answers
756 views

Tips for golfing in Factor

What general tips do you have for golfing in Factor? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Factor (e.g. "remove comments" is ...
cat's user avatar
  • 5,879
58 votes
25 answers
16k views

Tips for golfing in Jelly

Jelly is a tacit, golf-oriented programming language by our very own Dennis. It’s popping up in answers here more and more often, beating other golf-y languages like Pyth and CJam, both by using its ...
Lynn's user avatar
  • 68.7k
19 votes
5 answers
689 views

Reverse-Engineer the N-Bonacci sequence[s]

EDIT: I will be accepting an answer Monday, 2/15/2016. May the bytes be ever in your favor! In his "Print the N-Bonacci Sequence" challenge, @DJMcGoathem describes the N-bonacci sequences, wherein ...
Cyoce's user avatar
  • 3,331
47 votes
28 answers
5k views

Remove every N-th N

The task In this challenge, your input is a non-empty list of positive integers, given in the native format of your language. Your output is that same list, in the same format, with some elements ...
Zgarb's user avatar
  • 42.6k
192 votes
180 answers
20k views

What is the smallest positive base 10 integer that can be printed by a program shorter (in characters) than itself?

I think the question as above is clear, but just in case: Write a full program (not just a function) which prints a positive base 10 integer, optionally followed by a single newline. Qualifying ...
Arandur's user avatar
  • 1,947
73 votes
84 answers
6k views

No strings (or numbers) attached

If you like this, consider participating in: The Official Dyalog APL 2016 Year Game The monthly Dyalog APL 2017 Code Golf Challenge Make 12 snippets/expressions, in the same language, that result in ...
Adám's user avatar
  • 30.2k
12 votes
13 answers
1k views

Iterated Dice Rolling

Given an input n where 3 <= n <= 25, perform the following steps, starting with a single ...
user avatar
86 votes
225 answers
16k views

Count up forever

Write a program that counts up forever, starting from one. Rules: Your program must log to STDOUT or an acceptable alternative, if ...
vrwim's user avatar
  • 2,499
172 votes
494 answers
35k views

Implement a Truth-Machine

A truth-machine (credits goes to this guy for coming up with it) is a very simple program designed to demonstrate the I/O and control flow of a language. Here's what a truth-machine does: Gets a ...
a spaghetto's user avatar
  • 11.2k
112 votes
330 answers
22k views

Simple cat program

One of the most common standard tasks (especially when showcasing esoteric programming languages) is to implement a "cat program": read all of STDIN and print it to STDOUT. While this is named after ...
Martin Ender's user avatar
97 votes
15 answers
11k views

Create a programming language that only appears to be unusable

Robbers' challenge thread is here. Cops' challenge: Design a programming language that appears to be unusable for programming, but admits computation (or at least completion of the task) through some ...
feersum's user avatar
  • 31.4k
220 votes
89 answers
39k views

Make your language unusable

Try to write some code in your language and make it not satisfying our criteria of being a programming language any more. A language satisfies our criteria (simplified version for this challenge) of ...
jimmy23013's user avatar
4 votes
89 answers
4k views

Summation from a to b

The program has an input of a and b, and outputs the sum of numbers from a to b, inclusive. Score is in bytes. As always, standard loopholes are disallowed. If your input is in the format [a,b], +3 ...
user avatar
103 votes
300 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 ...
Daniel M.'s user avatar
  • 3,927

15 30 50 per page