Code-golf is a competition to solve a particular problem in the fewest bytes of source code. If you want to score by characters instead of bytes, state this explicitly in the challenge. If source code length is not the primary scoring criterion, consider using another tag instead.

learn more… | top users | synonyms

1
vote
0answers
8 views

Residue Number System

This is code-golf In the vein of large number challenges I thought this one might be interesting. In this challenge, we will be using the Residue Number System (RNS) to perform addition, ...
3
votes
0answers
23 views

Electrons bouncing in a wire

Imagine a "wire" that has n spaces. Imagine further that there are "electrons" in that wire. These electrons only live for one unit of time. Any spaces in the wire that are adjacent to exactly one ...
4
votes
2answers
35 views

Bridge Hand Scoring

One of the things that makes contract bridge very interesting is its highly complicated "artificial" meta game. This system of scoring hands is a small part of it. Bridge is a trick-taking card game. ...
10
votes
2answers
92 views

Connect the Dots

Given a series of os representing dots, connect them vertically or horizontally Examples Input: o o o Output: o---o | | o Input: o o o o Output: o---o----o | o ...
11
votes
9answers
126 views

Strict partitions of a positive integer

OEIS A000009 counts the number of strict partitions of the integers. A strict partition of a nonnegative integer n is a set of positive integers (so no repetition is allowed, and order does not ...
10
votes
8answers
179 views

Bijective mapping from integers to a variable number of bits

A variable number of bits is an array of 0 or more bits. So [0, 1] is a variable number of bits, but so is []. Write a function or program that, given an nonnegative integer returns a variable number ...
14
votes
1answer
56 views

Parse nested digit-lead strings

The task A string S is constructed with the following process: Start with S being the empty string. Insert at some position of S a string of the form ds, where d is a nonzero digit and s is a ...
8
votes
13answers
171 views

Congruence Relations

Given 3 positive integers a, b, and n (whose maximum values are the maximum representable integer value in your language), output a truthy value if a ≡ b (mod n), and falsey otherwise. For those ...
10
votes
17answers
351 views

Remove leading and trailing zeroes

Given a non-empty list/array containing only non-negative integers like this: [0, 0, 0, 8, 1, 4, 3, 5, 6, 4, 1, 2, 0, 0, 0, 0] Output the list with trailing and leading zeroes removed. The output ...
10
votes
9answers
481 views

Write a Metaquine

A metaquine is a program which is not a quine, but whose output, when run as a program in the same language, is a quine. The goal of this challenge is to write a metaquine. This is code-golf, so ...
16
votes
35answers
2k views

How even is a number?

The ancient Greeks had this thing called singly or doubly even numbers. An example of a singly even number is 14. It can be divided by 2 one time, and has at that point reached an uneven number (7), ...
12
votes
23answers
418 views

Filter out and add up

Task The task is very simple. Given a non-empty string containing numbers, uppercase and lowercase letters, output the sum of the remaining numbers. For example: a1wAD5qw45REs5Fw4eRQR33wqe4WE ...
0
votes
4answers
191 views

Math without math class [on hold]

You receive an input with a number and a string with a space in the middle. The string tells you what you need to do with the number, it can be: sqrt - square root of number sqr - square of number ...
5
votes
1answer
73 views

Calculating Parabolic Curves in 3D Space

Task Write a program or function that will determine if a point in 3D space lies on a 2D parabolic curve. Input 3 points in 3D space vertex of a 2D parabolic curve arbitrary point on the curve ...
15
votes
5answers
301 views

Expand shorthand increasing integer sequences

Given an input of a list of numbers in the format of a shorthand increasing integer sequence, output the sequence in full. Shorthand increasing integer sequence format works by finding every number n ...
2
votes
1answer
55 views

Convert to and from the backwards-factorial number base

I wanted to ask this question: Convert to and from the factorial number system but I'm a couple of years too late! So, instead you must convert to and from the lairotcaf backwards-factorial number ...
10
votes
0answers
99 views

Same-color arithmetic progressions

Van der Waerden's theorem says that For any given positive integers r and k, there is some number N such that if the integers {1, 2, ..., N} are colored, each with one of r different colors, ...
17
votes
7answers
288 views

Maximise the squared difference

Consider a permutation of the integer values from 1 to N. E.g. this example for N = 4: [1, 3, 4, 2] We'll consider this list to be cyclic, such that 1 and 2 are treated as adjacent. One quantity we ...
14
votes
2answers
177 views

Where does the spaceship go?

Based on an idea suggested by Zgarb. A spaceship is moving around a regular 3D grid. The cells of the grid are indexed with integers in a right-handed coordinate system, xyz. The spaceship starts at ...
30
votes
9answers
2k views

Sort these James Bond ratings

Introduction My grandpa is a fan of James Bond, but he is always unsure on how to rank his favourite actors. As such, he is always making lists, which is a lot of work. He asked me to produce a ...
1
vote
0answers
127 views

clickerhero mercenaries

Introduction I have recently started playing clickerheroes again. In the recent patch they introduced a new mechanic to mercenaries: their lifetime. Instead of having a random chance at dieing now ...
21
votes
7answers
856 views

Substitute numbers by their respective letter

Create a function or program that takes a number as input, and outputs a string where ASCII-code points for the lower and upper case alphabet are substituted by their character equivalents. The ...
0
votes
0answers
68 views

Find maximum frequency [on hold]

I have been given 2D matrix of size NxM. They are filled with values in range from 1 to 10^6. I need to find out maximum frequency of elements taking any row and column at a time. Constraints ...
14
votes
2answers
230 views

Arbitrary Precision Integer Division

We will be implementing division for arbitrarily large integers. This is code-golf. The task is to write a program or function that implements arbitrary precision integers and Division on them. ...
22
votes
3answers
478 views

Sort these bond ratings

The task The credit rating agencies assign ratings to bonds according to the credit-worthiness of the issuer, and the "Big Three" credit rating agencies use a similar (though not identical) tiered ...
24
votes
18answers
2k views

To be or not to be

In the fewest bytes possible, determine whether the two values given each match one of the following: First value 2 string or integer - whichever you prefer to case insensitive too case ...
2
votes
3answers
191 views

Write a radix sort

Goal As the title suggests, write a radix sort function (either MSB or LSB is fine) that accepts two parameters: an array of values of any type (you can assume that they are all of the same type / ...
18
votes
3answers
308 views

A small language deserves a small interpreter

Here is a very simple language definition: A Variable is any string that does not contain ^, <, >, !, or ? The empty string is a valid variable identifier The value of every variable starts at ...
12
votes
11answers
2k views

Convert English to a number without built-ins or libraries

This challenge is similar to this other, however I made a restriction (see bold text below) that I think would made it much diffent and (I hope) fun either. The Challenge Write a program or a ...
5
votes
3answers
270 views

Golf Me a Random Dubstep of the Day List

Aside of nursing my child, Vitsy, and dabbling in the art of code golf, I also am an avid dubstep fan, listening to all the new dubstep that Monstercat puts out as regularly as I can. I also share a ...
11
votes
2answers
222 views

Let's play some boardgame!

Introduction Boardgames are a classic play between kids, but there are some kids that feel bored playing a boardgame step by step. Now they want the result to be shown before they put their hands on ...
12
votes
6answers
781 views

Number of steps for a binary search

Given an input of a positive integer, output the number of steps it takes to find the input via a binary search starting at 1. We are simulating a binary search for the integer that was given as ...
6
votes
3answers
136 views

Inverse Champernowne Substrings

The Champernowne Constant is the irrational number 0.1234567891011... extending ad infinum. We've done a question about it before. But this question is about its reciprocal, known as the Inverse ...
12
votes
3answers
318 views

Challenge about advacado

Inspired by this. No avocados were harmed in the making of this challenge. Hello I have challenge I need help juic an avocado so I need program to tell me how long to juic avocad for Observe this ...
3
votes
2answers
69 views

Tips for Golfing in Vitsy

While there are only a few users of the Vitsy programming language right now, I wish to create a place for tips for golfing in Vitsy. What general tips do you have for golfing in Vitsy? I'm looking ...
11
votes
4answers
173 views

Help recalculate your rep!

A couple months ago, we had a discussion on meta about increasing the reputation awarded for upvotes on questions. Here's the basics of our current reputation system for votes:1 A question upvote U ...
7
votes
1answer
87 views

Tips for golfing in Retina

What general tips do you have for golfing in Retina? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Retina (e.g. "remove comments" is ...
31
votes
27answers
3k views

Hollow out an array

The task This challenge is very simple. Your input is a rectangular 2D array of integers, sized at least 1×1. It can be taken in any reasonable format. Your output shall be the input array, but ...
13
votes
3answers
211 views

Illustrate football team formations on a pitch

Football is the sport where players kick the ball, not carry it. Some confused individuals might call this soccer. A football team has one goalkeeper, and 10 players out on the pitch. There are ...
12
votes
12answers
1k views

Preparing a multiple choice test

Introduction Note: this is not some kind of method to encourage cheating. As Cᴏɴᴏʀ O'Bʀɪᴇɴ already said, studying is the best solution for passing a test :3. Consider the following answers to the ...
13
votes
7answers
632 views

Recursive 2x2 determinant

The determinant of a 2 by 2 matrix a b c d is given by ad - bc. Given a matrix of digits with dimensions 2n by 2n, n ≥ 1, output the result obtained by recursively computing the determinant of ...
25
votes
25answers
1k views

Output the van der Corput sequence

The van der Corput sequence is one of the simplest example of low-discrepancy sequence. Its n-th term is just 0.(n written in base 10 and mirrored), so its first terms are : 0.1, 0.2,0.3,0.4, ...
27
votes
18answers
3k views

Sort by Multiplying

You should write a program or function that given a list of positive integers multiplies each element with the smallest positive integer possible to create a strictly increasing list. For example if ...
2
votes
0answers
54 views

Cyclic prime number program generator

Challenge Your submission should consist of 2 or more programs each written in distinct languages. They can be arbitrarily numbered from 1 to k. Each program p, given a natural number n should ...
-1
votes
1answer
121 views

Find the square root, BUT [on hold]

Write a square root function that takes an input, positive or negative, and calculate it's square root, correct up to six decimal places (then truncate after the sixth decimal place). But, you cannot ...
24
votes
29answers
2k views

Determine the depth of an array

A simple challenge for your Monday evening (well, or Tuesday morning in the other half of the world...) You're given as input a nested, potentially ragged array of positive integers: [1, [[2, 3, ...
9
votes
3answers
239 views

Verify the birth number

A Norwegian Birth Number consists of 11 digits, composed the following way: DDMMYYiiikk DD is the day (from 01-31) MM is the month (from 01-12) YY is the year (from 00-99). It's not differentiated ...
4
votes
1answer
92 views

Write a Semiquine

Suppose you have 2 languages, A and B. A string s is a semiquine in A and B if it satisfies the following conditions: s is a quine in language A. s is a polyglot in A and B. The output of running s ...
0
votes
2answers
137 views

Print cos(2π/17) exactly

One way to construct a regular heptadecagon starts with drawing a horizontal line of length 1 from the center to a vertex. Then the distance along that line from the center to the second vertex is ...
14
votes
1answer
238 views

Implement the Enigma Machine

The Enigma machine is a fairly complex cipher machine used by the Germans and others to encrypt their messages. It is your job to implement this machine*. Step 1, Rotation Our enigma machine has ...