Linked Questions

234 votes
366 answers

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 ...
Dennis's user avatar
  • 210k
108 votes
38 answers

Source code ecological footprint

You've just been hired by a German car manufacturing company. Your first task, as an engineer, is to write a program that computes the ecological footprint of ASCII strings. The ecological footprint ...
Arnaud's user avatar
  • 8,503
106 votes
96 answers

Draw the national flag of France

There have been many other flag challenges posted but not one for the national flag of France. This week seems like an appropriate time. Produce this flag in the fewest bytes possible: The image must ...
steve's user avatar
  • 2,394
94 votes
15 answers

I am passive aggressive and want to insult my boss without him finding out

It's been a rough few months at work and I feel like I just want to scream right to my boss' face. I am, however, not one to directly confront people I have a problem with. I also don't want to lose ...
Christofer Ohlsson's user avatar
90 votes
107 answers

Count of "a"s and "b"s must be equal. Did you get it computer?

In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated: $$\large{L=\{a^n b^n:n\in\...
user avatar
66 votes
65 answers


Basing on this SO question. Challenge is rather simple: given a date period in the format YYYYMM output it in the format MMMYY. ...
pajonk's user avatar
  • 15.1k
66 votes
29 answers

Why was 6 afraid of 7?

Why was 6 afraid of 7? Because 7 8 9! Given a string apply the following transformations: If there is a 6 next to a 7 remove the 6 (6 is afraid of 7) If the sequence "789" appears remove the 8 and ...
geokavel's user avatar
  • 6,656
46 votes
19 answers

Lever Simulator 2015

Why a Simulator? Kids these days don't have the time nor the ambition to actually go and stack boxes on the see-saw or play around with balancing physical objects. This leaves lots of room in the ...
turbulencetoo's user avatar
42 votes
16 answers

Use xkcd's formula to approximate the world population

In xkcd 1047, Randall Munroe lists "slightly wrong" approximations of assorted quantities and numbers with varying precision and complexity, such as that the number of liters in a gallon is very close ...
NinjaBearMonkey's user avatar
41 votes
9 answers

"Convenient palindrome" checker

If you've ever tried to write palindromic code before, you'd know how much brackets tend to get in your way. ()() is not a palindrome, even though it kinda looks ...
algorithmshark's user avatar
29 votes
26 answers

Natural construction

The natural numbers including 0 are formally defined as sets, in the following way: Number 0 is defined as the empty set, {} For n ≥ 0, number n+1 is defined as n ∪ {n}. As a consequence, n = {0, 1, ...
Luis Mendo's user avatar
  • 104k
29 votes
13 answers

Lifetime of a Worm

Terms A worm is any list of nonnegative integers, and its rightmost (i.e., last) element is called the head. If the head is not 0, the worm has an active segment consisting of the longest contiguous ...
r.e.s.'s user avatar
  • 3,112
27 votes
21 answers

Primenary Strings

A Primenary (binary-prime) string is one which, when written as a binary grid, every row and column has a prime total. That's quite a vague explanation, so let's break it down with a worked example......
FlipTack's user avatar
  • 14.6k
23 votes
15 answers

Keep the unique characters down

It's very simple: Your program or function should generate the following text: ...
durron597's user avatar
  • 4,800
22 votes
10 answers

Can the maze be solved?

Task Print 0 if an n*m maze cannot be solved Print 1 if an n*m maze can be solved (in 1 or more ways) (so I'm not asking for ...
dwana's user avatar
  • 551

15 30 50 per page