instruction_seed
stringlengths
292
48.7k
found_ngrams
listlengths
0
21
A standard domino set has 28 unique pieces: Given a list of 28 or fewer unique dominoes, output the list required to make a complete set. Input and output dominoes are specified by two digits - the number of pips on each side of the domino, e.g. 00, 34, 40, 66. The digits may be given in any order, so 34 is the same d...
[]
Challenge description For every positive integer n there exists a number having the form of 111...10...000 that is divisible by n i.e. a decimal number that starts with all 1's and ends with all 0's. This is very easy to prove: if we take a set of n+1 different numbers in the form of 111...111 (all 1's), then at least ...
[]
For mostly historical reasons, bash is quite a hodge-podge of syntax and programming paradigms - this can make it awkward and sometimes frustrating to golf in. However it does have a few tricks up its sleeve that can often make it competitive with other mainstream script languages. One of these is brace expansion. Th...
[]
You have a deck of cards, consisting of cards with non-negative numbers on them, and you haven't shuffled it yet, and no player trusts the other players to be fair at shuffling. You devise a way to shuffle the deck that is completely deterministic, but chaotic enough that the other players are okay with using it. Here'...
[]
Introduction There are often times that we have challenges which require communication of some sort (such as in team KOTH), where density of information may be more important than density of code. There are a number of compression techniques that can allow us to convey more information in less space, but for simple dat...
[]
Consider some binary sequence, using 1 and 2, e.g.: 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1 ... Let's write down the run lengths of that: 1, 2, 1, 1, 2, 2, 1, 2, 1, 2, 2, 1 ... _ _ ____ ____ _ _ _ ____ 1, 1, 2, 2, 1, 1, 1, 2, ... In this case we happen to get another binary sequence. Of course, that's not g...
[]
Given a vector of \$n\$ values \$(x_1,x_2,x_3,\ldots,x_n)\$ return the determinant of the corresponding Vandermonde matrix \$V(x_1, x_2, \ldots, x_n) = \begin{bmatrix}1 & x_1 & x_1^2 & x_1^3 & \ldots &x_1^{n-1} \\1 & x_2 & x_2^2 & x_2^3 & \ldots &x_2^{n-1} \\ \vdots & & & \vdots & & \vdots \\ 1 & x_n & x_n^2 & x_n^3 & ...
[]
Given a list with number, output the ranges like this: Input: [0, 5, 0] would become [0, 1, 2, 3, 4, 5, 4, 3, 2, 1, 0]. This is mapping a range through the array, so we first have to create the range [0, 5], which is [0, 1, 2, 3, 4, 5]. After that, we use the 5 to create the range [5, 0]. Appended at our previous range...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ], [ 220, 16, 11, 220, 17, 11, 220, 18, 11, 220...
Here is a quick Monday morning challenge... Write a function or program in the least number of bytes that: Takes as input a list of [x,y] coordinates Takes as input a list of the [x,y] coordinates' respective masses Outputs the calculated center of mass in the form of [xBar,yBar]. Note: Input can be taken in any for...
[]
In the game Yahtzee, players roll five six-sided dice, and attempt to create certain hands to score points. One such hand is a small straight: four consecutive numbers, not necessarily in order. The three possible small straights are 1, 2, 3, 4, 2, 3, 4, 5, and 3, 4, 5, 6. For example, [3, 5, 6, 1, 4] contains the smal...
[ [ 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11, 323, 220 ], [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11...
Input A integer n ( ≥ 1) and a digit d (an integer such that 0 ≤ d ≤ 9). In either order; from stdin or parameters or whatever; to a program or function; etc. Output The integers from 1 to n inclusive (in order) whose decimal representations contain an even number of ds. (That is, the integers in the list are the integ...
[]
The Challenge Given a n x m matrix with n > 1 and m > 1 filled with integers 1 2 3 4 5 6 and a list of integers with exactly as many values as 2x2 blocks in the matrix ((n-1)*(m-1) if you need the exact number) [1, 2] Output the matrix with every 2x2 block rotated by the current value in the list in the given orde...
[]
This is the 2-dimensional generalisation of this challenge. For our purposes, one matrix (or 2D array) A is considered a submatrix of another matrix B, if A can be obtained by completely removing a number of rows and columns from B. (Note: some sources have different/more restrictive definitions.) Here's an example: A ...
[]
Resistors and other electronic components are typically manufactured with values that conform to one of the E-series of preferred numbers. IEC 60063 defines the following E-series: E6: 10 15 22 33 47 68 E12: 10 12 15 18 22 27 33 39 47 56 68 82 E24: 10 11 12 13 15 16 18 20 22 24 27 30 33 36 39 43 47 51 56 62 68 75 82 ...
[]
Inspired by an old manual... The challenge I define the ath suffix vector of b as the boolean list of length a with b trailing truthy values. Write a program or function that, given a and b by any means, returns the ath suffix vector of b by any means. Now this may seem trivial, but here is the catch: Your score is the...
[]
Introduction I found this question that was closed because it was unclear, yet it was a nice idea. I'll do my best to make this into a clear challenge. The Riemann Zeta function is a special function that is defined as the analytical continuation of to the complex plane. There are many equivalent formulas for it which...
[]
This was inspired by Problem 13 - Non-Repeating Binary of HP CodeWars' recent competition. Let's take a random decimal number, say 727429805944311 and look at its binary representation: 10100101011001011111110011001011101010110111110111 Now split that binary representation into subsequences where the digits 0 and 1 a...
[]
The Scenario You are given a matrix of size m x n (width x height) with m*n spots where there are a few obstacles. Spots with obstacles are marked as 1, and those without are marked as 0. You can move vertically or horizontally, but can visit each spot only once. The goal is to cover as much area/spots as possible, avo...
[]
If we have a list, say the list [9, 2, 4, 4, 5, 5, 7], we can do a moving average across it. Taking a window of say, 3 elements, each element is replaced by a window like such: [[9], [9, 2], [9, 2, 4], [2, 4, 4], [4, 4, 5], [4, 5, 5], [5, 5, 7]], and then taking averages, we get [9.0, 5.5, 5.0, 3.3333333333333335,...
[]
Inspired by this question Another way to unroll a 2D image into a 1D string is to use an Hilbert Curve. There are many version of this curve, depending on the number of iterations used while computing it. Below follow example of Hilbert Curves from first order to fifth order. The way of computing this curve is the fol...
[]
Write a program or function that accepts an integer in the range 1..3999 as input and returns the number of line segments required to express that integer in standard Roman numerals (so you would use XL but not VM). Examples: 1 -> 1 4 -> 3 5 -> 2 9 -> 3 10 -> 2 40 -> 4 50 -> 2 90 -> 3 100 -> 1 400...
[]
There is a virus inside a recipient of 5x5. As we know how it propagates its contamination, your mission is to output the last stage of the contamination. The recipient It will be representend as a two dimensional array of 5x5: 0 0 0 0 1 0 0 0 0 1 0 0 0 1 1 0 0 1 1 1 0 1 1 1 1 Where 1 means a position where the virus ...
[]
Background The parity of a permutation, as defined by wikipedia, is as follows: The sign or signature of a permutation σ is denoted sgn(σ) and defined as +1 if σ is even and −1 if σ is odd. The sign of a permutation can be explicitly expressed as sgn(σ) = (−1)^N(σ) where N(σ) is the number of inversions in σ. Alternat...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ] ]
Introduction Maximum-length sequences, usually known as m-sequences, are binary sequences with some interesting properties (pseudo-noise appeareance, optimal periodic autocorrelation) which make them suitable for many applications in telecommunications, such as spread-spectrum transmission, measurement of impulse respo...
[]
Write a function that when given a buffer b (1 - 104857600 bytes long) and a number of bits n (1 <= n <= 64), splits the buffer into chunks of n bits. Right-pad the last chunk with 0s up to n bits. e.g. Given the buffer b = "f0oBaR" or equivalently [102,48,111,66,97,82] and n = 5, return [12, 24, 24, 6, 30, 16, 19, 1, ...
[]
This is a code-golf question. Input A list of non-negative integers in whatever format is the most convenient. Output The same list in sorted order in whatever format is the most convenient. Restriction Your code must run in O(n log n) time in the worst case where nis the number of integers in the input. This means t...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ], [ 220, 16, 11, 220, 17, 11, 220, 18, 11, 220...
Gaussian integers are complex numbers of the form a+bi where a and b are both integers. In base -1+i, all Gaussian integers can be uniquely represented using the digits 0 and 1, without the need for a symbol to denote sign. For instance, 1100 in base -1+i represents the decimal number 2, since 1*(-1+i)^3 + 1*(-1+i)^2 +...
[]
The Challenge Given 3 numbers X, Y and Z in base B, find a Base in which the addition of X and Y yields Z. The inputs x = 20, Y = 12 and Z = 32 could yield 5 because 20 + 12 = 32 in base 5. You may assume that there will always be a base in which the addition is correct (there are cases where no base exists, thanks t...
[]
This used to be an old Computer Olympiad Question, not sure what the actual source was. Assume function f: f(1) = 1 This f(1), f(2), f(3), f(4), ... sequence of numbers are in ascending order. Number n has been repeated f(n) times Here is the sequence up to the fifteenth number: n : 1 2 3 4 5 6 7 8 9 10 11 12 13 ...
[]
Two distinct vertices in a directed graph are strongly connected if there is path in the graph from each to the other. A strongly connected component of the graph is a subset of the graph such that each pair of distinct vertices in the subset are strongly connected, and adding any more vertices to the subset would brea...
[]
In this challenge, you need to partition a list, where partitions have a max size, a min size, and a preferred size. I'll be using the notation (min,pref,max) to indicate the sizes in this challenge. For those unfamiliar with partitioning, the following list has been partitioned into parts of 3: [0..9] -> [[0,1,2],[3...
[]
Background Consider a round-robin tournament, in which each contestant plays one game against every other contestant. There are no draws, so every game has a winner and a loser. A contestant A is a king of the tournament, if for every other contestant B, either A beat B, or A beat another contestant C who in turn beat ...
[]
The challenge is simple: Determine the type of an input, and output an identifier telling what type it is. "UI", Unsigned integer: 0, 1,34, 111111111111111111111111111111111111111111 "SI", Signed integer: +0, +1, +42, -1, -3, -111111111111111111111111111111111111111111 "UD", Unsigned decimal: 0.0, 1.23, 1234.1234 "SD...
[]
Introduction Let a field be a rectangle filled with only the characters - and [0-9]. An example of a field is: 11-011123 111-010-- 0010---01 111-01234 You see that this field has been separated into three smaller areas: To calculate the score of a smaller area, we just add all numbers up. For example: 11 111 0010 111...
[]
Write a program or function that takes in a multiline string of 0's and 1's. No other characters will be in the string and the string will always be rectangular (all lines will have same number of characters), with dimensions as small as 1×1, but otherwise the 0's and 1's may be arranged arbitrarily. You may assume the...
[]
In this game two players compete to eat the most points worth of tokens, but there's a twist! Eating multiple tokens in a row of the same color gives an ever-growing bonus, but watch out, or your opponent will thwart your plans by eating the tokens you want before you can! Rules: 1 versus 1 n by n board (random size b...
[]
Introduction A pointer array is an array L of nonzero integers where 0 ≤ L[i]+i < len(L) holds for all indices i (assuming 0-based indexing). We say that the index i points to the index L[i]+i. A pointer array is a loop if the indices form a single cycle of length len(L). Here are some examples: [1,2,-1,3] is not a po...
[]
Most languages come with a built-in to search a string for all occurrences of a given substring and replace those with another. I don't know of any language that generalises this concept to (not necessarily contiguous) subsequences. So that's your task in this challenge. The input will consist of three strings A, B and...
[]
Given 5 distinct points on a two-dimensional plane, determine the type of conic section formed by the points. The output shall be one of circle, hyperbola, ellipse, or parabola. Rules The points will be in general linear position, meaning that no three points are collinear, and thus the conic passing through them will...
[]
I recently got a really weird irregular chess board. It's squares are all over the place and not even all connected. At least they're still laid out on a regular grid. I want to adapt the chess rules to be able to play on the board, but to start with, I need a piece that can actually go anywhere on the board, and it se...
[]
For the non-zero digits on a standard numpad 789 456 123 consider placing a chess knight at any digit and moving it around with any number of normal L-shaped jumps, tracing out a positive decimal integer. What positive integers can be expressed in such a way? One of them is 38, since the knight could start on the 3 an...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
Driftsort is a simple way to "sort" an array. It works by "sliding" or "rotating" the elements over in the array until the array is sorted, or until the array fails to be sorted. Let's walk through two examples. First, consider the array [10, 2, 3, 4, 7]. Since the array is not sorted, we rotate it once. (This can happ...
[]
Introduction It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive. This is not the same thing. That one is a (closed) not well-explained challenge. This is not the same thing. That one is about counting up indefinitely. Challenge Write a program or function that prints every intege...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
Introduction Gijswijt's sequence (A090822) is famously really, REALLY slow. To illustrate: The first 3 appears in the 9th term (alright). The first 4 appears in the 220th term (a long way away, but feasible). The first 5 appears at (approximately) the 10^(10^23)th term (just no). No one really even knows where the fir...
[]
In this challenge 2 years ago, we found the period of a unit fraction (1/n where n is a natural number). Now, your task is to write a program/function to find the repetend of a unit fraction. The repetend is the part of the decimal expansion which repeats infinitely, like: The decimal representation of 1/6 is 0.16666....
[]
Credits This challenge originated from @miles. Create a function that computes the CRC32 hash of an input string. The input will be an ASCII string of any length. The output will be the CRC32 hash of that input string. Explanation The algorithm of CRC32 and other CRC are essentially the same, so only CRC3 will be demo...
[]
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 groups: [1, 1, 1, 2, 2, 1, 1, 1, 1, 2, 2, 2, 1, 1, 1] 1, 1, 1 2, 2 1, 1, 1, 1 ...
[]
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 operate only on the 1st dimension, not on all dimensions of an array. Rules Standard loopholes are denied [[1, 2], [3, 4]] be...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
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. Your bot should be a complete program. It should accept input as a command line argument. The input will be a map of th...
[]
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 follows: Consider these two important trigonometric identities: $$ e^{i x} = \cos(x) + i \sin(x) \\ \sin^2(x) + \cos^2(x...
[]
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 number. The inside must be filled with spaces. The borders also must have the same width. The width and height of the squ...
[]
Important note: Because this challenge only applies to square matrices, any time I use the term "matrix", it is assumed that I am referring to a square matrix. I am leaving off the "square" description for brevity's sake. Background Many matrix-related operations, such as computing the determinant, solving a linear sys...
[]
Lower level languages, such as C and C++ actually have no concept of multidimensional arrays. (Other than vectors and dynamic arrays) When you create a multidimensional array with int foo[5][10]; This is actually just syntactic sugar. What C really does is create a single contiguous array of 5 * 10 elements. This foo[...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ] ]
Introduction Turns out, aliens love memes just as much as we do. Every alien race we've encountered so far has their own version of 2spooky4me (see the following question) and equivalent, though, with some variation. The inhabitants of planet CUTE1f can't handle a lot of spook, so their preferred spook is 1spooky2me, w...
[]
My local ACM chapter gives out door prizes to people who come to the meetings. You get an increased chance of winning if you solve the programming puzzle, however (but I always solve that puzzle). Thus, some people have 1 entry, while others have 2. But wait! The way the raffle program works is not by adding in another...
[]
Given three dice rolls (integer values from 1-6) in sorted order (so as to be indistinguishable), convert them to the sum of two fair dice with an identical distribution. The answer for three to one is summing them all, modulo 6. The end-result is a perfectly flat distribution, where each of the six numbers are equall...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
Steiner Chains are a set of N circles where each circle is tangent to 2 other non-intersecting circles as well as the the previous and next circles of the chain, as seen in the below images: In this challenge, you will write a program/function that draws Steiner chains recursively, that is, circles of a given chain ...
[]
related and inspired by -- Finding sum-free partitions A set A is defined here as being distinctly sum-free if 1) it consists of at least three elements, |A| ≥ 3, and 2) its distinct self-sum A + A = { x + y | x, y in A} (with x,y distinct, i.e., x≠y) has no elements in common with A. (Obsolete - do not use this goi...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ] ]
As a kid, I used to play the card game "golf" a lot. Your challenge, should you choose to accept it, is to calculate the score of a golf hand. Since there are over 9000 variations on this card game1, we will go with the rules I remember playing. Rules (of the game) You end a round with 6 cards, and you want as few poi...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
Given an integer N >= 1, output the mean number of bits in an integer from 0 to N - 1 Specification The output can be calculated as the sum of the number of bits in the binary representation of each integer from 0 to N-1, divided by N. The binary representation of an integer has no leading zeroes in this context, with...
[]
This question is probably harder than all of those "generate a sequence of numbers" tasks, because this requires TWO sequences working in unison. Really looking forward to the answers! In his book "Gödel, Escher, Bach: An Eternal Golden Braid", Douglas Hofstadter has a quite few sequences of numbers inside, all of them...
[]
Inspired by this question which was further inspired by this one, write a program which takes two integers and adds them in a unique way, by performing an OR operation on the segments used to display them in a 7-segment display. For reference, the digits are represented in the following way: _ _ _ _ ...
[]
Find the longest run of true in a list of booleans. Return the same list, with all other trues falsified. Input, output A list; any usual format (e.g., a delimited list as a string). Details True and false can be anything your language typically uses for those values, or the integers 1 and 0. If you use single characte...
[]
RFC 2550 is a satirical proposal (published on April 1, 1999) for a space-efficient ASCII representation of timestamps that can support any date (even those prior to the beginning of the universe and those past the predicted end of the universe). The algorithm for computing a RFC 2550-compliant timestamp is as follows ...
[]
Consider binary block diagonal matrices which have square blocks of 1s on the main diagonal, and are 0 everywhere else. Let's call such matrices "valid" matrices. For example, here are some valid 4x4 matrices: 1 0 0 0 1 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 1 1 0 1 0 0 1 1 0 0 0 1 1 0 0 1 1 1...
[]
Don't you find that reading simple text isn't appealing enough? Try our ##### ### ### ##### ##### ##### ##### # # ##### # # # # # # # # # # # # # # ##### ### # # # # #### # # # # # # # # # # # # # # ...
[]
Problem Say you have N stacks named S1 through SN, where each Sk (k = 1 to N) contains N copies of the number k. For example, when N = 3 the stacks looks like this: 1 2 3 <- top of stack 1 2 3 1 2 3 <- bottom of stack ======= 1 2 3 <- stack index Here there are 3 stacks indexed as 1, 2, and 3, and each one ...
[]
What's the Binary Time? Everybody knows what the normal time is. It's up there in the top-right (or wherever you put it) of your screen. But a question people rarely seem to ask themselves is this: What's the binary time? Binary Time Binary Time (True Binary Time) works by first reading the most significant bit (MSB) o...
[]
Remember that a set is unordered without duplicates. Definition An N-uniquely additive set S whose length is K is a set such that all N-length subsets in S sum to different numbers. In other words, the sums of all the N-length subsets of S are all distinct. Objective Given an array/set as input and a number N to a func...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ] ]
Write a program or function that takes in a nonempty list of positive integers. You may assume it is input in a reasonable convenient format such as "1 2 3 4" or [1, 2, 3, 4]. The numbers in the input list represent the slices of a full pie chart where each slice size is proportional to its corresponding number and all...
[]
A Faro shuffle is a technique frequently used by magicians to "shuffle" a deck. To perform a Faro shuffle you first cut the deck into 2 equal halves then you interleave the two halves. For example [1 2 3 4 5 6 7 8] Faro shuffled is [1 5 2 6 3 7 4 8] This can be repeated any number of times. Interestingly enough, if y...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
Given a list of integers L, and an integer N, output L splitted in N sublists of equal lenghts. Non-divisible lengths If N does not divide the length of L, then it is not possible that all sublists have equal length. In any case, the last sublist of the output is the one that adapts its length to contain the remainder ...
[ [ 20, 11, 22, 11, 16, 16, 11, 16, 18, 11, 16, 22, 11 ], [ 18, 11, 20, 11, 22, 11, 16, 16, 11, 16, 18, 11, 16 ], [ 11, 20, 11, 22, 11, 16, 16, 11, 16, 18, 11, ...
The 3BV of a Minesweeper board represents the minimum number of left clicks required to solve the board if you already know the solution. It stands for "Bechtel's Board Benchmark Value". Here's his site explaining it. Below is a solved Minesweeper board. The flags indicate mines; tiles without mines indicate the count ...
[]
Background: Here's a little simple challenge. You want to be able to find out whether the arrays inside an array have the same length. Input: Your input should consist of exactly one array (this is the value passed to the function, not a user input). Your function takes exactly 1 parameter. It could contain arrays or ...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ] ]
In a project I am working on, I am checking to see if certain DNA sequences appear in certain genes in E. coli. I have written a program in Java that performs the below features. However, since I wrote my program in Java, the universe needs to be corrected and rid of verbosity by having you write your code in as few by...
[]
Well, sum it down really. Write a program or function that takes in a nonempty list of decimal integers (0-9) and outputs a downward pointing "triangle" of digits with the input list at the top where every digit after the first line is the sum of the two digits above it modulo 10. For example, the input [7, 5, 0, 9] ha...
[]
Implement the Discrete Fourier Transform (DFT) for a sequence of any length. This may implemented as either a function or a program and the sequence can be given as either an argument or using standard input. The algorithm will compute a result based on standard DFT in the forward direction. The input sequence has leng...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ] ]
I think most people around here know what a 7-segment display for digits is: _ _ _ _ _ _ _ _ | | | _| _| |_| |_ |_ | |_| |_| |_| | |_ _| | _| |_| | |_| _| We can define the 7-segment difference (7SD) between two digits to be the number of segments that ...
[]
Given an integer N, output the Nth positive number K with the following property in decimal base: For each digit I at position P of K, the number formed from K by removing the Pth digit (i.e. I) is divisible by I. Example and remarks 324 is such a number: 3 divides 24 2 divides 34 4 divides 32 Note 1: we assume that ...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ], [ 220, 16, 11, 220, 17, 11, 220, 18, 11, 220...
In special relativity, the velocity of a moving object relative to another object that is moving in the opposite direction is given by the formula: \begin{align}s = \frac{v+u}{1+vu/c^2}.\end{align} s = ( v + u ) / ( 1 + v * u / c ^ 2) In this formula, \$v\$ and \$u\$ are the magnitudes of the velocities of the objects...
[]
Almost every function can be expressed as a polynomial with infinite terms. For example, e^x = 1 + x + x^2/2! + x^3/3! + x^4/4! + ... For example, sin(x) = x - x^3/3! + x^5/5! - x^7/7! + ... The coefficients of the n-th terms form a sequence, and the corresponding function is called the Generating Function of the seque...
[]
The Microsoft FAT file system has a directory table to represent which "files" are in which "folders" on the disk. For the time, these entries crammed a lot of information into a small amount of bits. There are a bunch of technical specifications over on Wiki for the curious, but the challenge here is going to focus on...
[]
Your goal is to create a function or a program to reverse the bits in a range of integers given an integer \$n\$. In other words, you want to find the bit-reversal permutation of a range of \$2^n\$ items, zero-indexed. This is also the OEIS sequence A030109. This process is often used in computing Fast Fourier Transfor...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ], [ 220, 16, 11, 220, 17, 11, 220, 18, 11, 220...
Definition Define the nth term of the CRAU sequence as follows. Begin with the singleton array A = [n]. Do the following n times: For each integer k in A, replace the entry k with k natural numbers, counting from 1 to k. Compute the sum of all integers in A. For example, if n = 3, we start with the list [3]. We repla...
[]
Definition Define the nth array of the CURR sequence as follows. Begin with the singleton array A = [n]. For each integer k in A, replace the entry k with k natural numbers, counting up from 1 to k. Repeat the previous step n - 1 more times. For example, if n = 3, we start with the array [3]. We replace 3 with 1, 2, ...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ], [ 220, 16, 11, 220, 17, 11, 220, 18, 11, 220...
An alternating sign matrix is an n by n matrix consisting of the numbers -1, 0, 1, such that: The sum of each row and column is 1 The nonzero entries in each row and column alternate in sign These matrices generalise permutation matrices, and the number of such matrices for a given n was of interest for some time. Th...
[]
Update: There are 6 mazes. They are included in the controller. There is a tar.gz of the mazes and their .bmp files here (dropbox). There is also a utility for making more mazes at that link (the maze_4.txt file is incorrect in archive). At this point, please feel free to run your own entry and update your score. Detai...
[]
GOAL : To Implement a character counting program This is how this counting system works : input of the program is a set of printable ASCII characters . the program counts each type of character , and outputs the number of each character , starting from first mentioned character to last mentioned character . Example :...
[]
Ninja Assassins - which ninja stays alive some basic information given an int N as the number of ninjas, return the number of the winning ninja. At the end only 1 ninja survives,the question is which one? what was his number?. Each ninja kills the ninja who stands after him. Afterwards, he passes the sword to the firs...
[]
In the game Stratego, the main game mechanic is when you attack an opponent's piece with yours. In this challenge, you job is to simulate one of these battles and say who survives. Specs You will get as input a pair of string representing Stratego pieces. The pieces are one of "S 1 2 3 4 5 6 7 8 9 10 B" (S is the Spy, ...
[]
The esoteric programming language evil has an interesting operation on byte values which it calls "weaving". It is essentially a permutation of the eight bits of the byte (it doesn't matter which end we start counting from, as the pattern is symmetric): Bit 0 is moved to bit 2 Bit 1 is moved to bit 0 Bit 2 is moved to...
[]
In scientific computing, it is often desirable to decompose some large domain into smaller "subdomains", then parallelize the computation by performing the work on each subdomain in parallel and the interaction of a subdomain with its neighboring subdomains. Since these interactions are typically data sync points, mini...
[]
Everybody loves nested lists! However, sometimes it's hard to make a nested list. You have to decide if you want to nest it deeper, or if you need to nest it shallower. So for your challenge, you must "Autonest" a list. To autonest a list, compare every pair of items in the list. If the second item is smaller, separat...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
Your challenge is simple: GIven an integer N, ouput every list of positive integers that sums to N. For example, if the input was 5, you should output [1, 1, 1, 1, 1] [1, 1, 1, 2] [1, 1, 3] [1, 2, 2] [1, 4] [2, 3] [5] These lists do not have to be output in any particular order, nor do the numbers inside each list. Fo...
[ [ 220, 16, 11, 220, 16, 11, 220, 17, 11, 220, 18, 11, 220 ], [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 16, 11, 220, 16, 11, 220, 17, 11, 220, 18...
Given a list of integers, create a boolean mask such that the true indices can be used to filter the distinct values from the list. Which index is selected as the true one does not matter as long as only one of them is selected for each set of indices corresponding to identical values. The input will be a non-empty lis...
[]
Challenge description Given a list / array of items, display all groups of consecutive repeating items. Input / output description Your input is a list / array of items (you can assume all of them are of the same type). You don't need to support every type your language has, but is has to support at least one (preferab...
[]
Task: Make a program that leaves a comment on this question. The content should be 1234567890123456. Edits: You may leave your usernames and passwords as U and P if you are using username and password. (if applicable) No URL Shorteners (if applicable) You may not use the browser console.
[]
Consider the following table for the function d(n), which calculates the number of factors that n is divisible by without a remainder: n | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | ... d(n) | 1 | 2 | 2 | 3 | 2 | 4 | 2 | 4 | 3 | 4 | 2 | 6 | ... Going from left to right, it is possible to determine the "c...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ], [ 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20, 11 ] ]
Inspired by this challenge Given a number m, output a program that prints out the string Do not repeat yourself. Now for the challenging part: Each program the original code prints out has to have the byte at place m*n be the same as m*n + 1 and the same as m*n + 2 .... all the way down to m*n + m - 1. (In case you can...
[]
A heap, also known as a priority-queue, is an abstract data type. Conceptually, it's a binary tree where the children of every node are smaller than or equal to the node itself. (Assuming it's a max-heap.) When an element is pushed or popped, the heap rearranges itself so the the biggest element is the next to be poppe...
[ [ 16, 11, 220, 17, 11, 220, 18, 11, 220, 19, 11, 220, 20 ] ]