instruction
stringlengths
34
53.1k
A zip bomb is a compressed file, designed so that unpacking it yields the biggest file possible. These are fairly well known, and there are examples of 42 KB files which expand into multiple petabytes of data. In this challenge, the goal is reversed. Instead of providing a compressed file which is then unpacked, the go...
This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :) Your Task Define two functions which together form a lossless round-trip String × String → String → String × String. More specifically, defi...
Elixir is a programming language with a feature called the pipe operator, |>, similar to the pipe in Bash and other languages. It passes the result of an expression on the left as the first parameter of a given function on the right. To clarify, here are some examples. 2 |> myFunction() is equivalent to myFunction(2) ...
The aim is to trim elements in from the ends of a list, depending on if they are in a second list of "falsey" results. For example, if the first list is [-1, 1, 2, 0, -1, 3, -1, 4, -1, -1] and the second is [-1], then we would remove all leading and trailing -1s from the first input, but not any -1s in the middle: [1, ...
Try it online! currently has 680 listed languages, all of which are searchable. For most of those languages, when searching for it, you don't have to enter the entire string. For example, entering lega results in just 05AB1E (legacy) appearing, and entering d+ results in only Add++. However, for some languages, there i...
We're back! And this time with an objective scoring criteria! This is a challenge I thought of recently which I think is not hard but allows for a wide range of possible solutions. Seems like a perfect fit for the creativity of PPCG users :) Your Task Define two functions combine and separate with respective types Str...
Imagine four people stand in a line. The first looks at a thermometer, and tells the temperature to the person on their right. This continues down the line, until the last person writes the temperature on a sheet of paper. Unfortunately, due to a miscommunication, every person in the line converts the temperature to th...
from Wikipedia, a number is called B-powersmooth if all prime powers \$p^v\$ that divide the number satisfy \$p^v \leq B\$. B-powersmoothness is important, for example, for Pollard's p-1 factorization algorithm. Task your task is to get two numbers, \$n\$ and \$B\$, and output if \$n\$ is \$B\$-powersmooth. Rules You ...
Fibonacci coding is a universal code, which can encode positive integers of any size in an unambiguous stream of bits. To encode an integer \$ n \$: Find the largest Fibonacci number less than or equal to \$ n \$; subtract this number from \$ n \$, keeping track of the remainder If the number subtracted was the \$ i \...
Background A polyhex of size \$n\$ is a contiguous shape made from joining \$n\$ unit regular hexagons side-by-side. As an example, the following image (from Wikipedia) contains all 7 distinct tetrahexes (polyhexes of size 4): A dihex is a polyhex of size 2. Now, let's define a sticky polyhex as follows: A single dih...
When I was in grade 3, we were taught how to solve a very simple math problem. It was equaling the denominators of two or more fractions. Let's take two proper fractions:- $$ \frac{1}{2},\frac{2}{3} $$ First we will take the Least Common Multiple of the denominators of the two fractions, the LCM of \$2,3\$ are \$6\$. T...
Dialogue by a 3Der. I was hired by Sr. 4Der to learn the 4D universe and I was willing to get to know more about it. But since I am a 3Der, I wouldn't see him, nor would I know how the real shapes look like. All I can do is illustrate. Sr. 4Der is pretty much invisible to us. We can't see him, but we can hear his voi...
I want format a JSON string into human-readable form. A string like this: '{"foo":"hello","bar":"world","c":[1,55,"bye"]}' would be formatted as: { "foo": "hello", "bar": "world", "c": [ 1, 55, "bye" ] } Rules: For objects and arrays properties and items should be starting in new line with indent...
Challenge Given a positive integer, find the fastest way to iterate over its digits. Bytecode size doesn't matter as much as speed of execution. Examples For 6875, the program would output 6 8 7 5. For 199182, it would output 1 9 9 1 8 2. For 0, it would output 0.
Step one In a new google sheet insert an image into cell A1 with Insert > Image > Image In Cell Step two Create a formula to return TRUE (if the cell contains an image) and FALSE (if the image is missing) Rules Only vanilla formulas are allowed. The shortest code in bytes wins.
Preamble There was a unit test in our codebase which was shuffling a string of length \$52\$ formed from the set of letters \$[A-Z]+[A-Z]\$ and then using the first \$20\$ characters of that shuffled string. It failed quite a while after being written due to no repeated character being present in those twenty and we wo...
AND THE WINNER IS.... Command Master's "Ball Pulling"! Note: Competition is over, but more submissions are welcome! Ball game is a game I invented where two players start with 100 energy each. Every turn, each player independently chooses an amount of energy to spend. Whoever spends more energy brings the ball 1 uni...
Taking a positive integer n as input, print the sample space of n consecutive coin flips. The coin is fair, with two sides H and T, each with probability 0.5. For example, Input - 3 Output - HHH HHT HTH HTT THH THT TTH TTT Rules Standard loopholes apply You may print the elements out of order, but all of them should ...
Idea from the doubler challenge, this may be more difficult. The program should output a positive integer or decimal point value higher than 0. If I duplicate the source code, the output should halve the original integer or decimal point value. But the trickier part is: If I duplicate your code any integer value \$n\$ ...
Consider a zero-sum game with 2 contestants. Each round, each contestant chooses, independently of each other, one of \$n \ge 2\$ different choices. Depending on the two chosen choices, one player is awarded an amount from the other player's pot. For example, the following table shows the gains (positive integers) and ...
Introduction Note that I learned it from a Numberphile Video, where Neil Sloane explains it better. I recommend you to watch his Video. But for a quick Introduction: The Levine Sequence is made from the Levine's Triangle, which is made as follows: First you have \$0\$ ones, and \$1\$ twos. Then you read the list back...
Introduction This challenge is inspired by the Meta Stack Exchange question The longest consecutive days streak; it turns out that the URL https://codegolf.stackexchange.com/users/daily-site-access/[user id], where the last number is your user ID (found in the URL of your profile) contains information about which days ...
Quote notation is a way of expressing rational numbers based on the concept of \$p\$-adic numbers, written in the form \$x'y\$. The quote indicates that the number to it's left (\$x\$) is "repeated" infinitely to the left, then prefixed to the number on the right (\$y\$). For example \$3' = \: ...3333\$ and \$764'31 = ...
Background: Take this input as an example: 1 1 2 1 1 2 1 3 1 3 If you look only at the first few digits, between 1 1 2 and 1 1 2 1 1 2 1, this input appears to consist of the pattern 1 1 2 repeating indefinitely. This would make its period 3, as there are 3 numbers in the pattern. Given only the first number, the peri...
Related: Cleaning up decimal numbers Background A continued fraction is a way to represent a real number as a sequence of integers in the following sense: $$ x = a_0 + \cfrac{1}{a_1 + \cfrac{1}{a_2 + \cfrac{1}{\ddots + \cfrac{1}{a_n}}}} = [a_0; a_1,a_2,\cdots,a_n] $$ Finite continued fractions represent rational number...
Challenge This coding challenge is to figure out how many rounds the cat can live. In a \$4\times4\$ matrix, there are a number of mice and exactly 1 cat. Example: $$ \begin{array} {|r|r|}\hline & & & ⬜ \\ \hline ⬜ & & ⬜ & ⬜ \\ \hline ⬜ & ⬜ & ⬜ & \\ \hline & & & \\ \hline \end{array} $$ But in each square of t...
The Binet formula is a closed form expression for the \$n\$'th Fibonacci number: $$F_n = \frac {\phi^n - (1-\phi)^n} {\sqrt 5}$$ where \$\phi = \frac {1 + \sqrt 5} 2\$ is the golden ratio. This formula works even when \$n\$ is negative or rational, and so can be a basis to calculating "complex Fibonacci numbers". For e...
Take the string abcdfghjk. To overwrite it, starting from f, with the string wxyz, you would continue along the original, replacing each character with the one from the replacement string. The result would be abcdwxyzk. Now, consider a string which would be too long to fit, like lmnopqrs. Starting at f you would get ab...
We're going rootin' tootin' cow-poke shootin! This is a simple contest, first program to draw their pistol wins. How it works: I require 2 things from you, an executable, and a command to be run from a bash terminal. The executable needs to do one thing: wait until it receives 'draw!' from STDIN, and then print 'bang!...
The brainiacs at New Scientist tweeted this morning that "The word STABLE has the neat property that you can cycle the first letter to the end to make a new word: TABLES. And you can do it again to make ABLEST." (https://twitter.com/newscientist/status/1379751396271124480) This is of course correct. It is not, however,...
Given a positive input \$n\$, output a random pair of primes whose difference is \$n\$. It's fine if there's another prime between them. Every pair should possibly appear and the program should have zero possibility to fall into infinite loop. It's promised that such pair exist, but not always infinite, so beware. You ...
There are \$a\$ honest man(always tell the truth), \$b\$ dishonest man(always tell lie), and \$c\$ random man(tell random Y/N). How many times at least should you ask one of them a yes/no question about who they are, to guarantee you get knowledge of who they are? You may assume that it's possible. Test cases: (a,b,c) ...
Robbers thread Your task is to create a method for hiding information in an image. You will post three encoded messages of your choice (keep them classy), each with its associated image. Reveal the messages for the first two images and do not reveal the third. Robbers have the task of determining what your third hidden...
Choose a challenge from the Cops thread, determine the third hidden message, and describe how the system works. Keep in mind limitations and possibilities available to Cops: You are not expected to guess any cryptographic secrets or additional information required to extract the hidden messages, as they should have al...
Ash has a bit of an interesting float division algorithm. It's designed to never return NaN, and things like signed zero and infinity need to be handled. How it works: Assume the inputs are positive for the rules below. One input being negative will always result in the output being negative, and both being negative wi...
Setup: A block is any rectangular array of squares, specified by its dimensions \$(w,h)\$. A grid is any finite ordered list of blocks. For example, \$\lambda = ((3,2),(3,1),(1,2))\$ defines a grid. Let \$\lambda\$ and \$\mu\$ be two grids with equal area. A tiling of \$\lambda\$ by \$\mu\$ is any rearrangement of the ...
Final results 1st place goes to Follow! Honourable mentions to The diff predictor (2nd), and Simple Killer, Low Blow and High to Low (joint 3rd). Other winners: (score competition) 1st - Simple Killer Honourable mentions: The diff predictor and Naiive. (wins competition) 1st - Crab Honourable mentions: Follow and High ...
The recent volume of MAA's Mathematics Magazine had an article "Connecting the Dots: Maximal Polygons on a Square Grid" by Sam Chow, Ayla Gafni, and Paul Gafni about making (very convex) \$n^2\$-gons where each vertex is a different point of the \$n \times n\$ grid. One is not allowed to have two consecutive segments ...
We had a challenge on Multiplicative Persistence here. As a recap, to get a multiplicative persistence of a number, do these steps: Multiply all the digits of a number (in base \$10\$) Repeat Step 1 until you have a single digit left. Then count the number of iterations. More here on Numberphile: Numberphile "What's...
Given a positive input \$n > 0\$, output the amout of two types based on their rarity. The two types are called \$A\$ and \$B\$, we know the followings: \$n\$ is a limited input and the maximum is \$nmax\$ At the start \$B\$ is twice as rare as \$A\$ As the presence of \$A\$ increade the rarity of \$B\$ decreases When...
Relatable scenario: I'm going to the store to buy a single item, but only have a $100k bill. As a result, I need exactly $99,979 in change, and in the fewest coins/bills possible because I'm quite obviously a very practical person. The denominations of these coins/bills follow the hyperinflation sequence: \$1, 2, 5, 10...
Challenge For any two non-empty strings A and B, we define the following sequence : F(0) = A F(1) = B F(n) = F(n-1) + F(n-2) Where + denotates the standard string concatenation. The sequence for strings "A" and "B" starts with the following terms: A, B, BA, BAB, BABBA, ... Create a function or program that, when given...
Giving n(any amount) of points (x,y). What's the minimum amount of circles required to cross every point given? Task Your program will get n (you can have n as part of input or use EOF instead) points (x,y). The points might at same place => (x1,y1) = (x2,y2) can happen x and y will be integer of range -10000~10000, wh...
The Meeker numbers are a 7 digit number in form of \$abcdefg\$, where \$a×b=10c+d\$ and \$d×e=10f+g\$. As an example \$6742612\$ is a meeker number, here \$6×7=10×4+2\$ and \$2×6=10×1+2\$, so it is a meeker number. Additionally, a Meeker number does not have any leading zeros (so \$a \ne 0\$) The Challenge Your program...
Program Write a program to display repeating terms of a given sentence. Explanation The program must output the repeating terms of two or more letters from the given input (input is a sentence separated by spaces without any punctuation except the full-stop indicating the end.) Repeated terms may not span across or in...
Background Flow Free is a series of puzzle games whose objective is to connect all the same-colored pairs of dots on the grid. Flow Free: Warps introduces the "warping" mechanic: a line connecting two dots can go through the border of the grid, which makes it re-enter through the opposite side of the grid (torus topolo...
Given 4096 16-bit integers, only four of which are unique and others appeared twice (so 2050 different integers exist). Find the four uniques. To time precisely and limit RAM usage, your program will be run on a 12MHz 8051(with 128B RAM). I'll test with a random case generated by some code to test, but we aim at the wo...
Sequel of this AWESOME challenge You, a genius tech prodigy detective, have successfully disarmed the bomb and want to break into the computer. The police found the password 67890-=yuiop[]hjkl;'\vbnm^&*()_+:"| on a piece of paper, but much of the keyboard is broken and there are no other ways of inputting characters. T...
The Home Prime of an integer \$n\$ is the value obtained by repeatedly factoring and concatenating \$n\$'s prime factors (in ascending order, including repeats) until reaching a fixed point (a prime). For example, the Home Prime (\$\text{HP}(n)\$) of \$10\$ is \$773\$ as: $$\begin{align} 10 & = 2 \times 5 \to 25 \\ 25 ...
Typescript is a typed superset of Javascript. For this challenge, we'll consider the following classic basic types: string number boolean undefined null And two "meta" types: any never The type any annotates that any type is valid: const a: any = "foo"; const b: any = 42; const c: any = true; const d: any = undefin...
A truck fleet dispatcher is trying to determine which routes are still accessible after heavy rains flood certain highways. During their trips, trucks must follow linear, ordered paths between 26 waypoints labeled A through Z; in other words, they must traverse waypoints in either standard or reverse alphabetical order...
I want to avoid responding to illegal or spoofed addresses. One type that's easy to detect is an address that should not exist on a packet received by my router: a special-use address. Challenge Given an IPv4 32-bit address, identify whether it is valid general-use address. Challenge rules Special-use addresses, as de...
Suppose denominations of banknotes follow the infinity Hyperinflation sequence: \$ $1, $2, $5, $10, $20, $50, $100, $200, $500, $1000, $2000, $5000, \cdots \$. How many banknotes are required, at minimum, to pay a \$$n\$ bill? Consider Alice needs to pay \$ $992 \$ to Bob. It is possible for Alice to use 7 banknotes \$...
Inspired by this question on Stackoverflow. The task Let's have two lists/arrays of integers: L1 and L2 of equal length. You need to identify in L2 the position of first occurrence of each number and remove from L1 the values on the corresponding positions. Then print/output the modified L1. Any reasonable input/ouput...
Homologous series, any of numerous groups of chemical compounds in each of which the difference between successive members is a simple structural unit. As an example, Alkane is a homologous group where the chemical compounds are in \$C_nH_{2n+2}\$ format. \$CH_4\$ (Methane) is part of the Alkane group because \$CH_4 \t...
Given a ASCII string containing control characters, compute what it should look like when printed to a terminal. Imagining the behaviour of a cursor, this is how to treat each character in the input: 0x08 backspace (\b): go left one (if already at the start of a line, do not go up) 0x09 horizontal tab (\t): go right o...
Given a positive integer as input, output the smallest positive integer such that appending its digits (in base 10) to the end of the input number will form a prime number. Examples 1 --> 1 2 --> 3 8 --> 3 9 --> 7 11 --> 3 20 --> 11 43 --> 1 134 --> 11 3492 --> 11 3493 --> ...
We can write mathematical expressions using the standard math operators (,),+,*,/,- available pretty much universally. We allow the symbols a, b, c, d and integers (e.g. 1, 45, etc.) but will restrict to just these four symbols. (Bonus points if you can handle more.) The goal is to take an expression as input and outpu...
An \$n\times n\$ Latin Square is a grid containing exactly \$n\$ distinct values where the values in each row and column are distinct. For example, $$\begin{matrix} A & B & C \\ C & A & B \\ B & C & A \\ \end{matrix}$$ is a Latin square as no row or column contains a repeated value. You are to take a positive integer \...
A \$k\$-hyperperfect number is a natural number \$n \ge 1\$ such that $$n = 1 + k(\sigma(n) − n − 1)$$ where \$\sigma(n)\$ is the sum of the divisors of \$n\$. Note that \$\sigma(n) - n\$ is the proper divisor sum of \$n\$. The sequence of \$k\$-hyperperfect numbers begins $$6, 21, 28, 301, 325, 496, 697, \dots$$ This ...
Write an infinite list of triangle codes, defined as code where the i-th line has i bytes for all lines, such that the i-th code generates (i-1)th code and has 1 more line than the (i-1)th code. The score is the number of lines in the initial code. Lowest score wins. For example, if . .. ... .... is outputted by . .. ...
Maximillian is the chief commander of the Great Greek Army and he is leading his forces into a crucial war with Spain. If all the enemy soldiers stand in a straight line incrementally marked starting from position 1, and a particular soldier at position \$i\$ dies, the soldiers at position \$2i\$ and \$2i+1\$ die as we...
Flavortext The Bystander Effect is a phenomenon where individuals are less likely to help a victim if other people are present. The idea is that as there are more people around, the individual burden is less, and each individual thinks "someone else will help them", which results in the counterintuitive fact that fewer...
Given a string, if it is even, break the string into 2 even parts, then reverse the parts to get the "reversencoded" string. Example: onomatopoeia -> tamonoaieopo If the string is not of even length, then do not change the position of the middle character, and reverse the letters before and after the middle character. ...
The age-old question - is it better to walk or run? There are two trains of thought. If you run, you cause the rain to effectively hit you from the front, which increases your surface area and basically causes you to run into the raindrops, getting hit with more water. However, if you walk, you spend longer in the rain...
Hamming number (also known as regular number) is a number that evenly divides powers of 60. We already have a task to do something with it. This time we are going to do the opposite. I define non-Hamming number as in: \$n\$ is non-Hamming number if and only if it satisfies following two conditions: \$n\$ is positive i...
Given a list of positive digits, return that list with consecutive elements grouped together. For example: [1, 2, 3, 5, 6, 5, 4, 4, 1] -> [[1, 2, 3], [5, 6, 5, 4], [4], [1]] Essentially, all adjacent elements whose absolute difference is 1 should be grouped together. The input array will only ever contain positive dig...
Challenge Implement the 1-indexed sequence A054049, which starts like this: 1, 2, 3, 6, 13, 5, 9, 377, 21, 11, 89, 14, 8, 233, 16, 987, 18, 2584, 20, 6765, 55, 23, 28657, 25, 75025, 27, 196418, 29, 514229, 31, 1346269, 33, 3524578, ... This sequence is the lexicographically smallest sequence of positive integers, so t...
Huge omega thanks to @wasif for emailing me this challenge idea in its basic form Everyone knows that questions on StackExchange require tags - labels that allow posts to be grouped together by category. However, most of the time, I barely know which tags exist, because there's just so many of them. Henceforth, today's...
Over is a higher-order function in multiple languages such as APL (⍥). It takes 2 functions and 2 values as arguments, applies the first function to both values, then applies the second to their result. For example, using ⍥ to represent Over: 1 ²⍥+ 2 We would first calculate ² of each argument: 1² = 1 and 2² = 4. We t...
The flag of Bangladesh is very simple. It looks like below: The flag will be in bottle green (#006a4e) and rectangular in size in the proportion of length to width of 10:6, with a red circle in near middle. The red circle (#f42a41) will have a radius of one-fifth of the length of the flag. This image will help you to ...
Vyxal is a golfing language that has 500+ different commands (achieved through overloads), and is a known beater of Jelly, 05AB1E and most golfing languages. Henceforth, it seems like a good idea to share some of the tips and tricks of the industry used to get terse programs in Vyxal. One tip per answer, and no stupid ...
You are provided with a non-empty array \$A\$ of integers, all greater than 0. But what good is an array if the elements do not sum up to the number \$N\$ (also provided as input)... So to change that, you can pick any integer of your choice present in the array and replace any of its digits with a different digit betw...
This challenge is inspired by the game No More Jockeys. The input is a list of tuples of natural numbers (potentially including 0), in some appropriate input format. Starting with player 0 and alternating with player 1, each player chooses some number which is contained within at least one remaining tuple, and all tupl...
Given a permutation of the alphabet and an intended "word", determine if the word was guessed in a game of Hangman, where the permutation is the list of guesses. For example, given ASTNORDYUVKFMCLWIHEBQGPJXZ as the permutation, and ASTRONAUT as the word, we know that the word was guessed. Only 2 letters (DY) were wrong...
Given a list of non-negative integers, return whether or not that list is all the same number. Rules Input and output can be taken/given in any reasonable and convenient format Truthy/Falsey values can be represented as any value of your choice as long as it's reasonable and relatively consistent (e.g. 1 for falsey an...
A math Olympiad will be held, and participants are being registered. The highest number of participants is 100. Each participant is given an ID number. It is given in a sequence like \$100, 97, 94, 91, 88, ...., 1\$, and when the first sequence is over, then \$99, 96, 93, 90, 87, ...., 3\$ sequence and so on. Let's ass...
CGCC hasn't always had MathJax. Back in the dark ages, it would have been necessary to write \$x^2\$ as x² (the horror!). In this challenge, you will be given some math which may include superscripts, and you should convert it to MathJax. Input: Input will consist of one or more letters a to z, some with superscripts. ...
Background Consider an \$n\times n\$ grid, where each cell is either empty (denoted by .) or a wall (denoted by #). We say that two cells are adjacent if they share an edge (a corner is not enough). A path is a sequence of distinct empty cells \$s_0,s_1,\ldots,s_k\$ such that cells \$s_i\$ and \$s_{i+1}\$ are adjacent ...
Task: Given an array of numbers as input (you can choose what subset, such as integers or natural numbers), replace all items with the number of times they appear within the array. As an example, [1, 2, 2, 1, 4, 8, 1] would become [3, 2, 2, 3, 1, 1, 3]. You can take input/produce output as arrays, lists, tuples, or any...
Conway's Game of Life is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are: Any live cell with 2 or 3 living neighbours (the 8 cells immediately around it) lives ...
Sometimes, I will think it is one day of the week (e.g Friday) when in reality, it's earlier in the week (e.g Tuesday). Your challenge is to display the number of days my estimates are off by. Challenge Given a day of the week I think it is, and the day of the week it actually is, output/return the number of days betwe...
During the 49 days between Passover and Pentecost, Jewish liturgy provides four numerical problems that I've here phrased as code golf problems. Input/Arguments These four, in any order, and by any means: A text \$L\$ consisting of exactly 7 sentences. The first and last sentences have 7 words each, the middle one ha...
Given a list of integers, such as {1, 4, 2, 8, 10}, TI-Basic's ΔList will determine the difference between every overlapping pair of items. In the given example, it would be {3, -2, 6, 2}. Task: Take a list of integers as input, in any reasonable way. All overlapping pairs {x, y} should become y - x, and the resulting ...
Background The sequence in the title is A245788 "n times the number of 1's in the binary expansion of n" ("times" here means multiplication), which starts like this: 1, 2, 6, 4, 10, 12, 21, 8, 18, 20, 33, 24, 39, 42, 60, 16, 34, 36, 57, 40, 63, 66, 92, 48, 75, 78, 108, 84, 116, 120, 155, 3...
Befunge Chess is an esolang mini-game I invented that is centered around the Befunge esolang. The general gist of the game is to make the instruction pointer land on a specific target cell while avoiding the opponent's target cell. Today's challenge isn't to play the game, but to simply execute arbitrary boards. The Ru...
You may be aware of the famous old rhyme, "I before E, except after C". It is a rule taught to aid in the spelling of certain English words. Quoting Wikipedia: If one is not sure whether a word is spelled with the digraph ei or ie, the rhyme suggests that the correct order is ie unless the preceding letter is c, in wh...
Dotcomma is a simple esolang I made a while ago that only uses four operators: [.,]. In this challenge, you'll determine if a dotcomma program consisting only of [.] halts. Without ,, there is no input, output, or queue, making this challenge possible. Blocks: Any code wrapped in [] is a block. All blocks and operators...
Given two positive integers \$n\$ and \$b\$, such that \$n > 2\$ and \$n > b > 1\$, count the trailing zeros when converting \$n\$ to base \$b\$. Your program should be able to handle any value of \$b\$ within your integer maximum. The digits of \$n = 18\$, \$b = 3\$ are \$[2,0,0]\$, so the correct output is \$2\$. T...
Quote notation[1] is a way of expressing rational integers in a precise, finite manner, based on the concept of \$p\$-adic numbers. The notation is in the form of a string of digits (\$0123456789\$) containing exactly one "quote" (a \$\newcommand{'}[2]{#1\text{'}#2} \text{'}\:\$) and one "radix point" (a \$.\:\$). Like...
Marshall Lochbaum's online BQN REPL has an interesting(and aesthetically pleasing) method of displaying arrays. Your task is to implement a version with simpler rules. [2,[3],4,[[[6,[5],7]]]] becomes: ┌─ · 2 ┌· 4 ┌· · 3 · ┌· ┘ ...
Inspired by this challenge, and similar to this and this. After seeing these, I figured I would continue the trend as there was no inclusive/exclusive sum. The goal here is to sum an interval of integers, either inclusive and exclusive, and output the total to stdout. Input format: either a ( or [ followed by 2 comma s...
You have played \$N\$ matches in some game where each match can only result in one of the two outcomes: win or loss. Currently, you have \$W\$ wins. You want to have a win percentage of \$P\$ or more, playing as few matches as possible. Output the minimum win streak that you need. Assume the current win streak is at \$...
Introduction The game Minecraft has a 1 in 10000 chance of showing "Minceraft" instead of "Minecraft" on the title screen. Your challenge Your challenge is to code a function or program that takes no input, and on average 1 of 10000 times, returns "Minceraft" and the rest of the time returns "Minecraft". Scoring This i...
You are Odysseus, and are finally free from Calypso (who has kept you captive for many years) after you drugged her while she was sleeping1. You wish to return to your homeland of Ithaca, but the ship you've stolen is a bit damaged and cannot steer. However, you have also stolen a map which contains the location of Cal...
Synopsis Your goal is to implement the (asymptotically) fastest growing function within bounded code on a fictional CPU utilizing a quite limited, yet (probably) turing-complete instruction set. Environment The CPU utilizes unbounded RAM as well as two registers, the accumulator A and the program counter C, with words ...
The generalised harmonic number of order \$m\$ of \$n\$ is $$H_{n,m} = \sum^n_{k=1} \frac 1 {k^m}$$ In this challenge, we'll be considering the generalised harmonic numbers of order \$2\$: $$H_{n,2} = \sum^n_{k=1} \frac 1 {k^2}$$ This sequence begins \$1, \frac 5 4, \frac {49} {36}, \frac {205} {144}, \dots\$ and conve...
This is a program I wrote in JavaScript to validate some inputted credentials, with an intentional vulnerability. The credentials_validator function takes an object as input, with usernames and passwords. It returns a function, which takes a username and password and returns true if the credentials are valid. Your chal...
In speedcubing, an Ao5 (Average of 5) is computed for a set of five times by removing the fastest and slowest times, and then computing the mean of the remaining three times. A "rolling ao5" is computed for a sequence of at least five times by computing the ao5 for every set of consecutive five times (some sets will o...
Gelatin is a worse version of Jelly. It is a tacit programming language that always takes a single integer argument and that has 7 (or maybe 16) commands. You are to take in a Gelatin program and its argument and output the result. Gelatin Gelatin programs will always match the following regex: ^[+_DSa\d~]*$ i.e. they...