instruction
stringlengths
34
53.1k
Objective Use any editor or IDE (vim, emacs, IntelliJ, etc) to write a valid "Hello, World" program in any C-like language. The "!" is optional, but you get style points if you use it. You may use publicly available plugins, a publicly available vimrc, etc, but you may not write or make modifications to them specifical...
Introduction - What is a necklace? A necklace is something that OEIS people are obsessed with. The OEIS challenge has like 5 necklace sequences. A binary necklace of length n is a loop with n beads that are either 0 or 1. Two necklaces are the same if one can be rotated to become the other, and two reversible necklaces...
A menger sponge is a fractal made out of cubes within cubes within cubes... If you start with a cube, on each face there are 9 squares. The middle square becomes empty (or 0). The other 8 squares iterate this process. They each get split up into 9 squares and the middle square face is taken out. The goal today is to ge...
Inspired by this chat message Your task will be to take a word and find the average position of its letters on the keyboard as a letter. Keyboard Layout Since layouts vary from keyboard to keyboard, we will be using a standard based of of my own keyboard in this question. The keyboard has 3 rows, the top row from lef...
Introduction You can skip this part if you already know what a cyclic group is. A group is defined by a set and an associative binary operation \$\times\$ (that is, \$(a \times b) \times c = a \times (b \times c)\$. There exists exactly one element in the group \$e\$ where \$a \times e = a = e \times a\$ for all \$a\$ ...
Inspired by Generate Keyboard Friendly Numbers. Background Many number pads have the following layout: 789 456 123     0     We define a number's neighborhood as the set of cells orthogonally adjacent to it on the numpad shown, including itself. For example, 2's neighborhood is {1,5,3,0,2} and 0's neighborhood is {1,2,...
Challenge Given a binary matrix and a binary string, determine if that binary string can be found starting at any point in the matrix and moving in any direction at any subsequent point to form the binary string. That is, can the string be found folded up however inside the matrix? The string can only be folded at 90 d...
Given two positive integers, \$A\$ and \$B\$, illustrate their least common multiple by outputting two lines of dashes (-) with length \$\text{lcm}\$\$(A, B)\$ after replacing every \$A\$th dash in the first line and every \$B\$th dash in the second line with vertical bars (|). In this way, the end of each line will be...
Introduction Cacti come in various different sizes, shapes and colors. However, the most iconic cactus and must-have in every Western has to be the saguaro. Important features are its size and arms, which have defined the stereotypical cactus appearance. Your task is to bring the saguaro in the ASCII world. However, ...
This is a simple(ish) web scraping challenge. Input Your code should take an MPAA film rating and a number from 0 to 100 as input. It can do this in any way you find convenient. Output Your code should return the name of any movie which has a) that film rating and b) the numerical score on the Tomatometer from rottento...
This is a more difficult version of It's a find-a-movie challenge . Input Your code should take a BBFC rating and a number from 1 to 5 as input. It can do this in any way you find convenient. Output Your code should return the name of any movie which has a) that film rating and b) that number of stars in a Guardian fi...
We all know that \$(-a) \times (-a) = a \times a\$ (hopefully), but can you prove it? Your task is to prove this fact using the ring axioms. What are the ring axioms? The ring axioms are a list of rules that two binary operations on a set have to follow. The two operation are addition, \$+\$, and multiplication, \$\...
How to spot them Take a positive integer k. Find its divisors. Find the distinct prime factors of each divisor. Sum all these factors together. If this number (sum) is a divisor of k (if the sum divides k) then, this number k, is a BIU number Examples Let's take the number 54 Find all the divisors: [1, 2, 3, 6, 9, 18, ...
In this polyglot challenge, you will work together to figure out how to output all the 26 letters of the English alphabet! How does this work? For each answer, you must pick a new language (or a new major version of a language, for example, python 2 and python 3 are counted separately) that prints the next letter after...
While doodling around with numbers, I found an interesting permutation you can generate from a list of numbers. If you repeat this same permutation enough times, you will always end up back at the original array. Let's use the following list: [1, 2, 3, 4, 5] as an example Reverse the array. Now our array is [5, 4, 3,...
This challenge is inspired by a board game I played some time ago. The story of this challenge doesn't necessarily have to be read, the goal of the challenge-section should explain everything necessary. The Story People are locked inside a large room with a human-devouring monster. The walls of the room are enchanted, ...
Background (skip to definitions) Euler proved a beautiful theorem about the complex numbers: \$e^{ix} = \cos(x) + i \sin(x)\$. This makes de Moivre's theorem easy to prove: $$ (e^{ix})^n = e^{i(nx)} \\ (\cos(x) + i\sin(x))^n = \cos(nx) + i\sin(nx) $$ We can plot complex numbers using the two-dimensional Euclidean plane...
For this challenge you will print the coordinates and color of each piece at the start of a game of checkers. Enter the x and y (comma seperated) for every square (indexed 0-7) on a checkerboard, followed by a "r" or "b" (for red or black) where the top of the board (closer to y=0) is red and the bottom is black. newl...
Given a positive integer nesting level n and string s of printable ascii characters( to ~, output a program which, when run in the same language, outputs a program which outputs a program . . . which outputs the string s. A total of n programs should be generated, all of which should be run in the same language as your...
Let us consider a regular n-sided polygon where all of the sides are equal in length with n being a natural number larger than or equal to three. All of the vertices lie on the unit circle (circle of radius one centered at the origin) and one of the vertices is always at the coordinate (x,y)=(1,0). Now let's draw all p...
String Stairs Disclaimer: This is the first challenge I propose. Any and all feedback is welcome. If this is a duplicate, please point it out. Here's a link to the sandbox post. Goal The goal of this challenge is to, given a string and an integer, print the string into blocks of that integer's size. If a word has more ...
For this challenge, a list is considered valid if and only if it consists entirely of integers and valid lists (recursive definitions \o/). For this challenge, given a valid list and an integer, return a list of all depths at which the integer can be found. Example Let's consider list [1, [2, [3, [1, 2, 3], 4], 1], 1] ...
This is a tips question for golfing in Python concerning the Evil Numbers question on Anarchy Golf. An number is evil if its binary expansion has an even number of 1's. The challenge is to print the first 400 evil numbers 0,3,5,...,795,797,798, one per line. The Python 2 submissions are led by llhuii with a 42-byte so...
Take two inputs, a non-empty vector/list containing digits 1 and 2 and a string (no, you may not take 0/1 instead). The string will be one of the following (in lowercase, exactly as written below: increasing decreasing ones twos all none If the string is ____ then you shall return the indices ___: increasing ... wher...
Definition: A number m is called a primitive root of a prime p the condition that the smallest integer k for which p dividies mk-1 is p-1 Your task Given a tuple (a,b) of positive integers, return the fraction: (number of primes p equal to or less than a which has b as a primitive root) divided by (number of primes ...
There are n people on a 2D plane. Using distances between them we're going to find their positions. To get a unique answer you must make four assumptions: There are at least 3 people. The first person is at position (0, 0). The second person is at position (x, 0) for some x > 0. The third person is at position (x, y) ...
Given a date, output the X and Y position of the current day of the date on a digital calendar. The digital calendar is sort of the calendar that gets shown when you click on your computers clock (at least on windows), and it looks something like this: If we assume that the given date is 25.09.2017, the result would b...
The Challenge Write a program that takes an integer N as input, and outputs the stage of life or death that a tree is currently in. N will always be between 0 and 10. The Stages of Life and Death Life: To draw a stage of life, simply draw a base of size N, consisting of ^ characters, then move up and substract 2 from ...
Background Skip to "Task" if you are familiar with Tic-Tac-Toe (I think most are!) Tic-Tac-Toe is a famous two-player game. It consists of a 3x3 board that is filled gradually by two players (clarifications below); The first player uses the character X and the other one uses O. The winner is the first to get 3 consecut...
Challenge You are given two distinct bit strings of the same length. (For example, 000 and 111.) Your goal is to find a path from one to the other such that: At each step, you change only one bit (you can go from 000 to any of 001, 010, 100). You cannot visit the same bit string twice. The path is as long as possible,...
CHALLENGE Given a set of grouped letters, arrange them onto the board so that they cover the area entirely. Board Representation (a.k.a. the SHIP DECK) The board is a 6x6 grid. There will always be 36 total squares. Columns are marked A-F. Rows are marked 1-6. Example: A B C D E F +---+---+---+---+---...
Programming is very rigid. You can't tell a program to "output the banana count", you have to tell it to print(bananas). But when you do that, you end up with a problem: you don't know how many bananas you have beforehand, so you don't know whether to use a plural. Sometimes, programmers go the lazy way. Instead of che...
Given two positive integers a and b, output the frequency distribution of rolling a b-sided die a times and summing the results. A frequency distribution lists the frequency of each possible sum if each possible sequence of dice rolls occurs once. Thus, the frequencies are integers whose sum equals b**a. Rules The fre...
Alpha Decay is a kind of radiation decay where every time the atom "decays", it loses a helium nucleus (an alpha particle). This means that an atom loses 2 protons and 2 neutrons each time. Your task is to simulate this, including the problems that occur during alpha decay. Given two integers as input, \$m\$ and \$p\$,...
Given an integer p > 1, find the smallest integer q > p such that the list of exponents in the prime factorization of q is the same of that of p, no matter the order or the value of the prime factors. Examples The prime factorization of p = 20 is 22 x 51. The smallest integer greater than p with identical exponents in ...
For the purposes of this question, the prime factorial of a number n is the result of multiplying all prime numbers smaller than n, and then multiplying the result by n. Your Task: Write a program or function to find the prime factorial of a number, as outlined above. Input: An integer n where n is greater than one...
You deal cards labeled 0 to 9 from a deck one a time, forming stacks that start at 0 and count up by 1. When you deal a 0, you place it on the table to start a new stack. When you deal any other card, you stack it atop a card that's exactly one lower in value, covering it. If there's no such card, the deck isn't stac...
Suppose a new fairy chess piece named the Wazir is introduced to chess. Wazirs can move from a position (x, y) to:  (x+1, y)  (x, y+1)  (x-1, y)  (x, y-1) That is, they move orthogonally like the rook, but only one step at a time like the king. How many such wazirs can be placed on an N×N chessboard so that no two wazi...
I guess I'm not the only one who have seen this kind of image on Facebook (and other sites). The picture above was posted 16 days ago, and has accumulated 51 k comments. Some answers: 0, 4, 8, 48, 88, 120, 124 and so on. Challenge: The mathematics in the question doesn't make sense1, so we can't find the correct answ...
The Bible is one of the most influential books ever written, and commonly cited as the best selling book of all time. It was written by approximately 40 different authors over hundreds of years before being compiled into it's current form. But what's interesting about The Bible is the way it's divided up. It is split u...
Introduction: We all know these three basic arithmetic math tables I assume. ADDITION: + | 1 2 3 4 5 6 7 8 9 10 ---------------------------------- 1 | 2 3 4 5 6 7 8 9 10 11 2 | 3 4 5 6 7 8 9 10 11 12 3 | 4 5 6 7 8 9 10 11 12 13 4 | 5 6 7 8 9 10 11 12 13 14 5 | 6 7 8 9 10 11 ...
Introduction Given five points in the plane, your task is to compute the area of the ellipse passing through these points. You can assume that exactly one non-degenerate ellipse can be constructed with the given input values. Rules Input is 10 integers in any convenient form, corresponding to the x and y coordinates of...
Definition Narcissistic 1 integers of an array think they are better than their neighbours, because they are strictly higher than their arithmetic mean. Neighbours are defined as follows: If the integer is at index 0 (the first), then its neighbours are the last and the second elements of the list. If the integer is ...
Given an ordered list of 2 or more 2D cartesian points, output a truthy value if either the path touches itself or self-intersects; otherwise output a falsy value if it does not touch itself or self-intersect. You may assume that consecutive points in the list are distinct. Examples: (0,0), (1,0) -> falsey (0,0), (1,0)...
Given a positive integer N, output the innermost N×N square of an ASCII art spiral made of -|/\ that spirals clockwise inward. The - is used for horizontal portions, | for vertical portions, and / and \ for corners. The first character is - and the spiral proceeds left and down. Specifically, when N is 1 the output is:...
Inspired by digital roots, the prime factoral root of a number is the number that emerges when you take the prime factors of a number, add them together, and repeat the process on the resulting number, continuing until you end up with a prime number (which has itself as its only prime factor, and is thus its own prime ...
Multiplication between 2 integers can be reduced into a series of addition like so 3 * 5 = 3 + 3 + 3 + 3 + 3 = 5 + 5 + 5 Exponentiation (raising a to the power b) can also be reduced into a series of multiplications: 5 ^ 3 = 5 * 5 * 5 Therefore, exponentiation can be reduced into a series of additions, by creating a ...
Given a positive integer n output the n-th number of the euro-iginal sequence. Calculating the Sequence This sequence is equal to OEIS A242491. A number is part of said sequence if the number can be made up by using as many different euro coins or notes, but only one of each. Note that you don't have to consider cents....
Input: Two strings without newlines or whitespaces. Output: Both input strings on separate lines, with spaces where necessary† for one of the two strings. And a third line with the characters A, R, M and , representing added, removed, modified, and unchanged. † We add spaces to either the top or bottom input string (if...
I have the following code which I've written to emulate Newton's method for deriving the square root of a number: r=(x,y)=> (z=((y=y||x)*y-x)/(2*y)>1e-15)? r(x,y-(y*y-x)/(2*y)):y Where r(37) would result in 6.08276253029822 which is great given the limitations of my browser. I'd like to golf this code further seei...
Let's imagine we have a matrix of bits (which contains at least one 1): 0 1 0 1 1 0 1 0 0 1 0 0 1 0 1 0 0 1 0 1 1 0 0 0 1 0 1 1 0 1 0 1 0 1 1 0 0 1 0 0 1 1 0 1 0 0 0 1 0 1 1 0 0 1 0 We want to set some of the bits in this matrix such that it forms a contiguous blob of 1s, in which every 1 is directly or indirectly con...
Take an input list L containing positive integers, and insert the least amount of integers into the sequence, so that you make it a continuous one. Example: L = 4 2 6 1 Out: 4 3 2 3 4 5 6 5 4 3 2 1 The input and output formats are optional. Test cases: L = 1 Out: 1 L = 10 4 Out: 10 9 8 7 6 5 4 L = 13 13 Out: 13 13 ...
Take two positive integers N and M and create the concatenated cumulative sums of [N], with M iterations. Output the result of the last iteration. Definition of the concatenated cumulative sum: Start with a number N and define a sequence X = [N] Append to X the cumulative sums of X Repeat step 2 M times. The cumulati...
Given two positive integers p and q, your task is to return the array A created by applying the following algorithm: Start with A = [p, q] and d = 2 For each pair (x, y) of contiguous numbers in A whose sum is divisible by d, insert (x + y) / d between x and y. If at least one matching pair was found, increment d and ...
The problem #6 of IMO 2009 reads: Let a 1, a 2, a 3, ..., a n, be distinct positive integers and let T be a set of n-1positive integers not containing a 1+a 2+a 3+...+a n, A grasshopper is to jump along the real axis, starting at the point 0 and making n jumps to the right with lengths a 1, a 2, a 3, ..., a n in so...
Your task: write a program/function that when given a string containing only ASCII characters, outputs/returns the string in reverse-ish. Example: 1) Input Hello, World! 2) Number unique characters in input. (Input string separated by pipes (|) for readability) H|e|l|l|o|,| |W|o|r|l|d|! 1 2 3 4 5 6 7 8 9 10 3) ...
Introduction / Background In a recent discussion in the crypto chat I was challenged to discuss / help with the Fermat primality test and Carmichael numbers. This test is based on the premise that a^(p-1) mod p==1 will always hold for primes p, but not always for composites. Now a carmichael number is essentially the F...
Note: this challenge has been posted on the sandbox. Introduction This challenge is inspired by 2009 Putnam B1, a problem in an undergraduate mathematics competition. The problem is as follows: Show that every positive rational number can be written as a quotient of products of factorials of (not necessarily distinct...
For the purpose of this challenge, a Prime Power of a Prime (PPP) is defined as a number that can be defined as a prime number to the power of a prime number. For example, 9 is a PPP because it can be represented as 3^2. 81 on the other hand is not a PPP because it can only be represented as 3^4, and 4 is not prime. ...
This is part of a cops-and-robbers challenge. Go here for the robbers' part. The Cops' Challenge You should write a program or function in a language of your choice, which outputs the string Haystack. However, it must be possible to remove some subset of characters from your program (without reordering the rest), such ...
This is part of a cops-and-robbers challenge. Go here for the cops' part. The Robbers' Challenge A cop's answer can be cracked by removing any subset of characters from the Haystack program, so that it outputs Needle instead of Haystack (while still being a valid submission in the same language). You don't have to find...
One way to represent a natural number is by multiplying exponents of prime numbers. For example, 6 can be represented by 2^1*3^1, and 50 can be represented by 2^1*5^2 (where ^ indicates exponention). The number of primes in this representation can help determine whether it is shorter to use this method of representat...
If Abe goes, then Beth and Diana go. If Beth goes, then Catherine goes. If Catherine goes, then Diana goes. If Diana goes, then Ezra goes. Only three people go. Who goes? Challenge Given a list of several pairings of people, such that in each pairing the second person goes if the first person goes, and a positive integ...
This challenge is similar to my previous one, but has a twist that makes it significantly more difficult. There are n people on a 2D plane. Using distances between them we're going to find their positions. You may make four assumptions: There are at least 3 people. The first person is at position (0, 0). The second pe...
The "prime ant" is an obstinate animal that navigates the integers and divides them until there are only primes left! Initially, we have an infinite array A containing all the integers >= 2 : [2,3,4,5,6,.. ] Let p be the position of the ant on the array. Initially, p = 0 (array is 0-indexed) Each turn, the ant will mo...
Unlike most languages, Python evaluates a<b<c as it would be done in mathematics, actually comparing the three numbers, as opposed to comparing the boolean a<b to c. The correct way to write this in C (and many others) would be a<b && b<c. In this challenge, your task is to expand such comparison chains of arbitrary le...
I saw another prime challenge coming by in PPCG, and I do love me some primes. Then I misread the introductory text, and wondered what the creative brains here had come up with. It turns out the question posed was trivial, but I wonder if the same is true of the question I (mis)read: \$6\$ can be represented by \$2^1\...
For the purpose of this challenge, a smaller-base palindrome (SBP) is a number which is palindromic in a base between 1 and itself (exclusive), and is not a repdigit in the same base. For example, 5 is a SBP because it is a palindrome in base 2 (101). The first few SBPs are 5,9,10,16,17,20,21,23,25,26,27,28,29,33... ...
There have been a lot of prime-/prime factorization-related challenges recently, so I thought it might be interesting to go the other way. Given: a positive integer n, and a non-empty list of positive integers f write a full program or a function to find the smallest integer i such that i >= n and i is a product of n...
Consider a bridge of length B formed by tiles labeled with the digits of the positive integers concatenated. For example, if B was 41, then it would look like this: ----------------------------------------- 12345678910111213141516171819202122232425 Now imagine a train of length T crossing the bridge. The leftmost poi...
Given an integer n, print out n * reversed(n) reversed(n) is the number you get when you reverse the digits of n. reverse(512) = 215 reverse(1) = 1 reverse(101) = 101 >>>>>>>> func(5) = 5*5 = 25 func(12) = 12*21 = 252 func(11) = 11*11 = 121 func(659) = 659*956 = 630004 Shortest code wins! Leaderboard var QU...
According to RollingStone, below are the 26 greatest singers of all time: Aretha Franklin Al Green Ray Charles Robert Plant Elvis Presley Mick Jagger Sam Cooke Tina Turner John Lennon Freddie Mercury Marvin Gaye Bob Marley Bob Dylan Smoke...
Alphabet Rain The Task: The basic premise is to print out the input string and then repeat each character vertically, based on it's (0-indexed) position in the (case-insensitive) alphabet A-Z. A is at location 0 so is not repeated, e is at position 4 so is repeated 4 times, P is at position 15 so is repeated 15 times, ...
For the purpose of this challenge, a multi-base prime is a prime which, when written in base 10, is prime in one or more bases smaller than 10 and larger than 1 as well. All single-digit primes are trivially multi-base primes. 11 is also a multi-base prime, as 11 in binary is 3, which is prime (it is also prime in ba...
Given a matrix, sum its values up/down or left/right to form an X, fold it up, and return the list. I describe the algorithm here: Algorithm Your input will be a odd-sized square matrix of integers within your language's reasonable numerical capacity. Let's take the following matrix as an example: 1 2 3 2 1 0 3 2 3 0 4...
Lets define a pointer sequence to be any sequence such that a(n) = a((n-1)-(a(n-1))) forall n greater than some finite number. For example if our sequence begun with 3 2 1 Our next term would be 2, because a(n-1) = 1, (n-1)-1 = 1, a(1) = 2 (this example is zero index however it does not matter what index you use the...
Most of us are probably familiar with the concept of triangular and square numbers. However, there are also pentagonal numbers, hexagonal numbers, septagonal numbers, octagonal numbers, etc. The Nth Nagonal number is defined as the Nth number of the sequence formed with a polygon of N sides. Obviously, N >= 3, as th...
We haven't had a string question for a while (5 days to be precise), so let's go for one. Given a string s and a positive integer n, take every nth element of s, repeat it n times, and put it back into s. For example, if n = 3 and s = "Hello, World!", every third character is Hl r!. You then repeat each character n tim...
Given a nonempty finite list of integers, output a truthy value if there are exactly two equal entries and all other entries are distinct, and a falsey value otherwise. Examples truthy: [1,1] [1,2,1] [1,6,3,4,4,7,9] falsey: [0] [1,1,1] [1,1,1,2] [1,1,2,2] [2,1,2,1,2] [1,2,3,4,5]
Write a function or program that given a list of non negative integers, arranges them such that they form the largest possible number. INPUT [50, 2, 1, 9] OUTPUT 95021 INPUT 0 OUTPUT 0 INPUT (Interesting one) [7, 76] OUTPUT 776 RULES standard loopholes apply. Depending on your language you can use int(32) / in...
Siteswap is a notation for juggling patterns. The other siteswap puzzle is great and it explains siteswap in greater detail than here. This puzzle is meant to be a bit simpler! Numberphile recently interviewed Colin Wright which helped develop the notation. The part at ~16min will be useful for this challenge. Another ...
Let's define a sequence of integer square roots. First, a(1) = 1. Then, a(n) is the smallest positive integer not seen before such that sqrt(a(n) + sqrt(a(n-1) + sqrt(... + sqrt(a(1))))) is an integer. Some examples: a(2) is 3 because it's the smallest integer such that sqrt(a(2) + sqrt(a(1))) = sqrt(a(2) + 1) is int...
Zeroless numbers are numbers that do not contain 0 as one of their decimal digits. Given an integer K, return the Kth zeroless number. K will be non-negative if you choose 0-indexing, or positive if you choose 1-indexing instead. Note that this is OEIS A052382. This is code golf, so the shortest code in bytes wins. Tes...
Many people consider RPS to be a game of chance. If both players play unpredictably, the best strategy is to play randomly. However, let's introduce a bit of predictability to it. Each bot will have a chance to tell the other bot what it's going to play simultaneously. Then there is a pause in which each bot will know...
Challenge Given a string input, output the demolished version of it. The Process P r Pr r o o o g g g r r r rogr r a -> a -> a -> a -> a -> -> -> -> -> m m m m m m m ...
Given a string as input, print a new string with each letter pushed to the right by its respective alphabet index. We all know that A is a slow and Z is a fast letter. This means that Z gets shifted to the right by 25 spaces, A doesn't get shifted at all and B gets shifted by 1 space. Your program only has to handle up...
Given two integers, which may be negative, zero, or positive, \$a\$ and \$b\$ (taken in any reasonable format, including inputting a plain complex number), convert it to \$a + bi\$ where \$i\$ is the imaginary number (square root of negative one). Then, raise it to the power of a third (positive integer) input variable...
There are quite a few means in mathematics, such as the arithmetic mean, the geometric mean, and many others... Definitions and Task Note that these are the definitions for two positive integers*: The root mean square is the square root of the sum of their squares halved (). The arithmetic mean is their sum, halved ()...
A subsequence is any sequence that you can get from another by deleting any amount of characters. The distinct non-empty subsequences of 100 are 0, 1, 00, 10, 100. The distinct non-empty subsequences of 1010 are 0, 1, 00, 01, 10, 11, 010, 100, 101, 110, 1010. Write a program or function that given a positive integer n ...
Here is the code which I want to shorten. n=input() while n: s=raw_input() x,r,g,b=(int(x) for x in s.split()) a=x/r%2 c=x/g%2 d=x/b%2 r=((a*10+c)*10)+d if r==0:e="black" elif r==100:e="red" elif r==1:e="blue" elif r==10:e="green" elif r==101:e="magenta" elif r==11:e="cyan" elif r==110:e="yellow" else:e="...
Task: Take a string as input and if it meets the requirements, accept the password. Input: a string, e.g. someString, asjk23t89h, 123456789abcdef. Output: two distinct values representing "secure" and "insecure", e.g. 0/1, true/false, secure/insecure. Password requirements: In order for a password to be determined as s...
The binary-square-diagonal-sequence is constructed as follows: Take the sequence of positive natural numbers: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, ... Convert each number to binary: 1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111, 10000, 10001, ... Concatenate them: ...
Former US Secretary of Defense, Donald Rumsfeld, famously popularized the phrase "known knowns." Here we're going to distill his remarks into a four-line stanza. Specifically, output this text: known knowns known unknowns unknown knowns unknown unknowns Capitalization doesn't matter (for example, Known unKnowns is fin...
You will be given a 2-D array A of integers, and a length N. Your task is to find within the array the straight line (horizontal, vertical or diagonal) of N elements that yields the highest total sum, and return that sum. Example N = 3, A = 3 3 7 9 3 2 2 10 4 1 7 7 2 5 0 2 1 ...
This is Hole-1 from The Autumn Tournament of APL CodeGolf. I am the original author of the problem there, and thus allowed to re-post it here. Given a list of numbers, produce a horizontal bar chart of # characters for how many numbers fit into each of ten equal-sized groups. For example, if the data ranges from 0-100...
Task The letters spell out actual words, but if you replace each letter with a digit from 0–9, it also “spells” an arithmetic equation. The trick is to figure out which letter maps to each digit. All the occurrences of each letter must map to the same digit, no digit can be repeated, and no “word” can start with the di...
A000330 - OEIS Task Your task is simple, generate a sequence that, given index i, the value on that position is the sum of squares from 0 upto i where i >= 0. Example: Input: 0 Output: 0 (0^2) Input: 4 Output: 30 (0^2 + 1^2 + 2^2 + 3^2 + 4^2) Input: 5 Output: 55 (0^2 + 1^2 + 2^2 + 3^2 + 4^...
TASK print integers n, where 12 <= n <= 123456789, and all pairs of consecutive digits in n have the same positive difference between them (e.g. 2468 but not 2469). NO INPUT. Output: 12 13 14 15 16 17 18 19 23 24 25 26 27 28 29 34 35 36 37 38 39 45 46 47 48 49 56 57 58 59 67 68 69 78 79 89 123 135 147 159 234 246 258 3...
A number is in base-b simplified Goodstein form if it is written as b + b + ... + b + c, 0 < c ≤ b The simplified Goodstein sequence of a number starts with writing the number in base-1 simplified Goodstein form, then replacing all 1's with 2's and subtracting 1. Rewrite the result in base-2 simplified Goodstein for...
This is Hole-3 from The Autumn Tournament of APL CodeGolf. I am the original author of the problem there, and thus allowed to re-post it here. Given: a number of turns (please state if no movements is 0, otherwise we'll assume it is called 1) and a list of one or more starting positions (in any form, e.g. 0 or 1 ind...