# All Questions

11,158 questions
Filter by
Sorted by
Tagged with
3k views

### Who's next to me in the queue?

Problem 4 in the 2019 BMO, Round 1 describes the following setup: There are $2019$ penguins waddling towards their favourite restaurant. As the penguins arrive, they are handed tickets numbered ...
2k views

### Roll for Initiative!

Roll for Initiative! Introduction In tabletop games like Dungeons and Dragons, when you begin a battle, all involved parties roll for initiative. In DnD 5e, this is ...
625 views

### Find the number of n-by-n (-1, 0, 1) matrices with zero permanent as quickly as possible

The permanent of an $n$-by-$n$ matrix $A = (a_{i,j})$ is defined as: $$\operatorname{perm}(A)=\sum_{\sigma\in S_n}\prod_{i=1}^n a_{i,\sigma(i)}$$ For a fixed $n$, consider the $n$-by-$n$ ...
4k views

### Round up my number

Sandbox Given two positive integers a and b, return the smallest multiple of b that is greater than or equal to a. Examples Definitions: true = ...
271 views

### Morpion solitaire

Morpion solitaire This is a game that I remember having learnt from my grandparents in my childhood. Initially I didn't know the name. G B has found it to be Join Five (or less ambiguously - Morpion ...
3k views

### How many atoms in the hydrocarbon?

How many atoms in the hydrocarbon? A hydrocarbon is a chemical compound which consists of only hydrogen and carbon atoms. For this challenge, we will only consider the three simplest kinds of ...
245 views

### Find all possible dates [closed]

You get a string which contains an integer between 1000 and 99999999 as input. The input string might contain leading zeroes but ...
254 views

### Is this board Latin-style?

Inspired by Flow Fit: Sudoku, a brand-new mobile puzzle game (as of Nov 2019). Background A Latin square is a square grid of side length $n$ filled with $n$ different symbols, where each row ...
2k views

### Next Shared Totient

The totient function $\phi(n)$, also called Euler's totient function, is defined as the number of positive integers $\le n$ that are relatively prime to (i.e., do not contain any factor in common ...
89 views

### Parallel resistance in electric circuits in C [duplicate]

What are some tips on how to shorten this code even further? The code is meant to compute the parallel resistance of an electric circuit. Using scanf ...
358 views

### Draw a fully-rendered path from direction changers

(Note: this challenge is distinct from my other challenge (Draw a path made from direction changers) because of it's rendering of direction (horizontal or vertical), crossing points and single or ...
3k views

### Is this platform game level winnable?

Given a level from a simple platform game, your task is to make a program or function to determine if a level is winnable. Platform game levels are 4 characters tall and any number of characters wide. ...
4k views

### How many times, are they multiples?

You are given three parameters: start(int), end(int) and list(of int); Make a function that returns the amount of times all the numbers between start and end are multiples of the elements in the list....
2k views

### How divisible are you?

You are to create a program which, when given a positive integer $n$, outputs a second program. This second program, when run, must take a second positive integer $x$ and output one of two ...
661 views

336 views

### Rock Paper Scissors (Sorta) Quine

Create three programs, which we'll call Rock, Paper, and Scissors. Each program must be unique, and accept input. If a program gets any input which is not one of the programs Rock, Paper or ...
430 views

### Circular robot instructions

This challenge is based on Project Euler problem 208. Also related to my Math Stack Exchange question, Non-self-intersecting "Robot Walks". You have a robot that moves in arcs which are $1/n$ of a ...
4k views

### How close are we, really?

Please note: this is a restricted-source challenge — see details below! Each natural number $n$ has 10 faces: its decimal representations in bases $1$ through to $10$. For example, the 10 faces ...
180 views

### Chopping Unicode Bytes [closed]

Introduction Each Unicode codepoint can be represented as a sequence of up to 4 bytes. Because of this, it is possible to interpret some 2, 3, or 4-byte characters as multiple 1-byte characters. (See ...
496 views

### Country name mashup generator

Part 1 of the task is here Flags Mashup Bot is a small Twitter bot that generates a new country name based on two random country names and tweets the result every couple of minutes. Task Your task ...
363 views

### Simplify the following C ascii graphing function

This wasn't originally intended for code-golf, just as a little debugging routine to roughly visualize something "goofy" going on in a model of some (irrelevant here) physical process. But when I saw ...
5k views

### Draw the Ionising Radiation Hazard Symbol

Draw the ionising-radiation-hazard-symbol in an arbitrary colour on a distinctly coloured background. The specific proportions were published in the June 27th 1974 issue of the Federal Register of the ...
501 views

### Decorate Pascal's Triangle

Although what is a Pascal's triangle is well-known and we already can generate it, the task is now different: Output $n$ first lines of the Pascal's triangle as colored bricks. Color number is ...
386 views

### How short can you get?

You are to write a program that, when given an integer between 1 and 5 (or 0 and 4 if you wish to use 0-indexing), outputs one of Code, ...
356 views

### Calculate Coefficient of Inbreeding

Your task is, given a family tree, to calculate the Coefficient of Inbreeding for a given person in it. Definition The Coefficient of Inbreeding is equal to the Coefficient of Relationship of the ...
4k views

### Help me pair my socks

Disclaimer: This challenge inspired by me trying to find pairs in a large pile of socks. Disclaimer: This is looking for a very different process and output to Help me sort my socks!. Please don't ...
7k views

### Pointlessly make your way down the alphabet

Disclaimer: This challenge inspired by me spending the morning debugging recursive functions, which have been frying my brain a little. Here's an example of recursion, from a letter, we keep going to ...
4k views

### Simulate reproduction in a population of oozes

Reproductive strategy of oozes can be summarized as follows: o O 8 oo A population of oozes at generation N is described by a string, for example: ...
2k views

### Inverse Look-and-Say

Background The Look and Say Sequence is built up by reading off the digits of previous entries in the sequence, counting the number of digits in groups of the same digit. For example: ...