Questions tagged [code-golf]

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

Filter by
Sorted by
Tagged with
18
votes
8answers
775 views
+300

Translate a Glypho program

Given an input of any valid Glypho program, output its "human-readable" counterpart. Glypho is an interesting esolang idea: The instruction reference is given here. For each instruction, the ...
18
votes
11answers
682 views
+200

Recursive Binary Description

Recursive Binary Description Recently, I made my very first contribution to OEIS by extending and adding a b-file to sequence A049064. The sequence starts with 0, ...
21
votes
14answers
2k views
+50

Letters between two letters

Write a program that accepts a single lowercase word as input and outputs the number of pairs of letters that have the same number of letters between them in the word as in the alphabet. For example, ...
39
votes
79answers
4k views
+100

Division and remainder

This challenge, while probably trivial in most "standard" languages, is addressed to those languages which are so esoteric, low-level, and/or difficult to use that are very rarely seen on this site. ...
10
votes
3answers
346 views
+200

Find the nth base-b digit of (b^k-1)^-2

Task Your task is simple. Write a program or function which takes three positive integer arguments n, k, and b in any order, such that 2 ≤ b ≤ 36, and returns or outputs the nth (1-indexed) base-b ...
10
votes
18answers
739 views
+100

Output nearby primes

Write a program which takes an input (which may or may not be prime), and lists the immediate prime following and preceding it. Example input: 1259 Example ...
12
votes
41answers
2k views
+100

How long is my number: Restricted Version

Find the original challenge here Challenge Given an integer, Z in the range -2^31 < Z < 2^31, output the number of ...
14
votes
10answers
1k views
+50

Let's practice the scoring rules of 421!

421 is a rather popular dice game in France and some other European countries. It is mostly played in bars and pubs to determine who's going to buy the next round of drinks. The full game is usually ...
3
votes
7answers
288 views
+50

Tips for golfing in Scala 3

What general tips do you have for golfing in Scala 3? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Scala 3 (e.g. "remove ...
128
votes
267answers
32k views
+100

Fibonacci function or sequence

The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first ...
13
votes
5answers
469 views
+250

Negative Space Graphs

Task You will be given a positive integer and you must output a "self-complementary graph" with that many nodes. If you don't know what a self-complementary graph is the wikipedia article wont help ...