3
votes
0answers
65 views

Double run-length encoding

Everyone knows what run-length encoding is. It has been the subject of many code-golf challenges already. We'll be looking at a certain variation. Example Normal: ...
-5
votes
0answers
33 views

Is there a face? [on hold]

Face-recognition software is fairly prevalent now, why don't we make it smaller? Your Task Write a program that, given an image, outputs whether or not it contains a face. (Human preferably, but if ...
0
votes
0answers
46 views

Drawing the Number ASCIIuare [duplicate]

You have to write a function/program that will draw an ASCII art of a square made with numbers. Challenge This program will take one input n as a positive integer and draw a hollow square using this ...
-4
votes
0answers
60 views

The 3n Plus One Puzzle [on hold]

I am trying to get into the habit of solving programming puzzles in my spare time but am stuck on the first one(which I know can be for a large number of reasons hence my posting for help). Shown ...
-2
votes
0answers
44 views

Discrete uniform circular distribution [on hold]

1) Have a distribution of a discrete number N of angular values in the interval [0:360] 2) Map these N values onto a unit circumference. 3) Automatically determine the two values between which all ...
12
votes
5answers
306 views

Find a maximal rectangle of 1s

Background I want to buy an plot of land and build my house on it. My house should be rectangular, and as large as possible; however, the available plots have lots of rocky areas that I cannot build ...
3
votes
7answers
247 views

Continued Fraction of a Rational Number

The continued fraction of a number n is a fraction of the following form: which converges to n. The sequence a in a continued fraction is typically written as: [a0; a1, a2, a3, ..., an]. Your goal ...
10
votes
1answer
162 views

Write a program whose nontermination is independent of Peano arithmetic

Challenge Write a program P, taking no input, such that the proposition “the execution of P eventually terminates” is independent of Peano arithmetic. Formal rules (In case you are a mathematical ...
11
votes
7answers
762 views

Matrix Trigonometry

Introduction The two most common trigonometric functions, sine and cosine (or sin and cos for short), can be extended to be matrix-valued functions. One way to compute the matrix-valued analogs is as ...
17
votes
19answers
1k views

Finite Cantor's Diagonal

Given a list of N integers, each with N digits, output a number which differs from the first number because of the first digit, the second number because of the second digit, etc. Example Given this ...
6
votes
1answer
138 views

Outline a PNG image

Intro (semi fictional) I'm the solo developer of a game, I'm already struggling with character design as is. Hence I've thought of a smart solution, I'll just use images for regular monsters, outline ...
24
votes
8answers
1k views

Remove unnecessary parentheses

You are given a string composed with the characters 0123456789+*(). You can assume that string is always a valid mathematical expression. Your task is to remove the unnecessary parentheses, assuming ...
8
votes
2answers
281 views

Read n random lines from a potentially huge file

This challenge is about reading random lines from a potentially huge file without reading the whole file into memory. Input An integer n and the name of a text file. Output n lines of the text ...
9
votes
2answers
166 views

Building a Bridge

Your task is to build a bridge to connect two cliffs given an input d, the distance apart. d will always be even However, the bridge needs columns to hold it up. Each column can hold a max of 6 ...
-2
votes
0answers
54 views

C# Question Program Credit Check [on hold]

Problem: Write a program named CheckCredit that prompts users to enter a purchase price for an item. If the Value entered is Greater than the credit limit of $5000 , display an error message: ...
-7
votes
17answers
228 views

Find the remaining side of the tangential quadrilateral!

(Taken from https://en.wikipedia.org/wiki/File:Tangential_quadrilateral.svg) A tangential quadrilateral (see example above) is a quadrilateral in which a circle can be inscribed. Your task is to ...
5
votes
1answer
180 views

Tiling by substitution

EDIT: The incorrect A rhomb substitution has been fixed. Apologies to anoyone who had started working on a solution. Consider the following substitutions, where the substituted rhomb(us) is scaled up ...
-1
votes
0answers
56 views

Sudoku Solver: Create an algorithm to solve basic sudoku puzzles [duplicate]

Obviously it would be unreasonable to ask for code that could universally solve all sudoku puzzles. Therefore in this case I'm only asking for something which can solve fairly easy puzzles. To define ...
3
votes
6answers
285 views

Traveling on a flat Earth

Coordinates in the flat-Earth world consist of latitude (x) and longitude (y), which are integers in the range 0...9999. Much like Gaussian integers, but they are always written using this notation: ...
8
votes
2answers
185 views

Interpret DOGO!

Interpret DOGO DOGO is a lesser known programming language. While the original DOGO (a joke language from a Usenet post) has never been implemented, a language resembling it has been created. The ...
3
votes
3answers
144 views

Golf the K-means algorithm

K-means is a standard unsupervised clustering algorithm, which, given a set of "points" and a number of clusters K, will assign each "point" to one of K clusters. Pseudo-Code of K-means Note that ...
-4
votes
0answers
33 views

How to set VAR as a list with more than one output and use it in command line argument [on hold]

netsh wlan show profiles > profile.txt for /f "skip=9" token=2 delims=:" %i in (profile.txt) do set "var=%i" netsh wlan show profile name=%var% key=clear now this command works if only one SSID is ...
19
votes
5answers
331 views

ASCII piano keyboard

Piano keys are 3 characters wide, and 7 characters tall. However, if every key was 3 charactes wide, there wouldn't be enough room for the black keys. That's why some of the white keys have parts ...
2
votes
11answers
321 views

Filter this string!

Your task is to write a program that will filter out some characters in a string, so that the remaining spells out (part of) the other string. Let's say we received the string ...
16
votes
13answers
2k views

Counting in bijective base 62

The task is to generate all the strings from 'a' to '999' including upper case characters like so: 'a', 'b', 'c' ... 'y', 'z', 'A', 'B', 'C' ... 'Y', 'Z', '0', '1', 2' ... '8', '9', 'aa', 'ab', 'ac' ...
4
votes
7answers
368 views

Calculate the Gamma function for half-integer arguments

Gamma function is defined as It is a well-known fact that for positive integers it coincides with a properly shifted factorial function: Γ(n) = (n - 1)!. However, a less famous fact is Γ(1/2) = ...
19
votes
6answers
1k views

Determine If a Challenge is Worth Answering

I am a very casual code golfer, and don't often see posts until they show up in the "Hot Network Questions" sidebar over on StackOverflow. Usually, I'm late to the game, and since the only language I ...
5
votes
19answers
468 views

Briefest code to find vowels and print consonants

Challenge: Read a string from user, print number of each vowel, then place all remaining chars in a line. Shortest answer wins! Output must look like this: Enter String: Input Vowel Count: ...
27
votes
8answers
906 views

Between the Lines

While doodling around on square-ruled paper the other day, I came up with the above negative-space font for digits. In case you haven't spotted it yet, the spaces between the above shapes yield the ...
13
votes
5answers
290 views

KOTH: TNT Run Challenge

This was inspired by a Minecraft mini-game. The rules are pretty simple: you run and jump around, and every block you step on disappears once you've stepped on it. The goal is to be the last one left. ...
11
votes
7answers
511 views

Print the Nth non-palindromic number

Print the Nth non-palindromic number A palindromic number (in case you don't know) is a number which reads the same backwards and forwards (example, 11). The first 15 non-palindromic numbers are: 10, ...
32
votes
28answers
9k views

The rice and chess problem

An Indian legend tells the story of the alleged inventor of the chess game, who impressed the emperor of India with his game so much that he would get rewarded with anything asked. The man said he ...
-2
votes
0answers
39 views

Long jump info system using dictionaries in python 3 [on hold]

this is the brief I have to do: Its for an athletics long jump contest. The program will 1. prompt the user for the names of competitors, then 2. for each competitor, ask for the distances that they ...
10
votes
15answers
987 views

Probability of something happening at least n out of m times

Write a program or function, that given a success probability p, a number n and a number of trials m returns the chance of at least n successes out of m trials. Your answer must be precise to at ...
7
votes
1answer
146 views

Reconstruct a missing RGB channel

Look at these photographs of natural scenes, with one of the RGB channels taken out of them: Source (with red): https://en.wikipedia.org/wiki/File:Altja_j%C3%B5gi_Lahemaal.jpg Source (with ...
12
votes
3answers
344 views

Minimize Those Ones [on hold]

Your task is to build a natural number using the fewest number of ones and only the operators + or -. For example, the number seven can be written 1+1+1+1+1+1+1=7, but it can also be written as ...
6
votes
1answer
60 views

Tips for golfing in Swift

What are some tips for code-golfing in Swift? Its focus on safety seems to make it difficult to golf in, but that makes little tips and even more useful. Are there any features in Swift that may help ...
20
votes
3answers
1k views

Rainbowlify An Image

This challenge is about gradually shifting hues in an image to make pretty pictures like this: (original) Challenge Write a program or function that takes in two non-negative integers and an image ...
19
votes
13answers
2k views

Golf Text into DNA

Text to DNA golf Challenge Convert input into a DNA output. Algorithm Convert text into ASCII code points (e.g. codegolf -> [99, 111, 100, 101, 103, 111, 108, 102]) String the ASCII codes ...
-18
votes
12answers
194 views

Reverse a 1-dimensional array

Note: This challenge is not the same. Challenge Believe it or not, we haven't got ONE challenge for reversing one-dimensional arrays (although we've got one for n-dimensional ones)! This should ...
-1
votes
1answer
91 views

Encrypting and Decrypting Challenge [on hold]

Encrypting Challenge Your encrypting program must be able to do following things: Input password Generate random key Encrypt random key with set key Then, the decrypting program must be able to ...
24
votes
14answers
3k views

KOTH: Every coin has two sides

Introduction After my previous KOTH with heavy themes (fantasy war, worldwide pandemic...), I'm back with a new lighthearted game. This time, you are facing off in a "board game-like" situation. A ...
2
votes
1answer
74 views

Scale up an image! [duplicate]

Your task is to write a program/function to scale up an image (list of strings) by a factor of n. Specs You will receive two inputs: an image, and a positive integer. The image will only contain ...
10
votes
2answers
196 views

Is this uniquely concatenable?

In this challenge about prefix code, we learnt that prefix codes are uniquely concatenable. That means, they can be joined together without separator, and without ambiguity. For example, since ...
24
votes
17answers
2k views

Is it a prefix code?

In information theory, a "prefix code" is a dictionary where none of the keys are a prefix of another. In other words, this means that none of the strings starts with any of the other. For example, ...
6
votes
6answers
293 views

Draw a phi triangle

Clarification: Basically, you need to make this Euler's totient function has the name phi. Let's try to calculate phi(8) First, list all numbers 8 and under backwards, not including 0 or under 8 7 ...
7
votes
1answer
108 views

Drilling For Oil

Congratulations! You have just been hired by a Fortune 499 company specializing in oil drilling. Your job is to write a program to determine the optimum placement of OilRUs' drill (represented by a ...
-7
votes
7answers
199 views

Are my eyes open or closed?

You are trying to guess my emotion. I will give you an adjective, as the input to the function/program. Your task is to output the state of my eyes, either O_O for open, or ._. for closed. Details ...
13
votes
11answers
551 views

Smallest groups in an array

Introduction Let's observe the following array: [1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1] A group consists of the same digits next to each other. In the above array, there are 5 different ...
15
votes
5answers
313 views

Automatic house-builder

Automatic house building nanobots have been fabricated, and it's your job to code them. Here is the house created by input 7 4 2 /-----/| / / | |-----| | | | | | | / |_____|/ The ...

15 30 50 per page