instruction_seed stringlengths 292 48.7k | found_ngrams listlengths 0 21 |
|---|---|
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
]
] |
Your task is to create a program or function that generates a zipper with a length of 10 lines. Each line of the zipper is represented by two dashes --:
--
--
--
--
--
--
--
--
--
--
The program/function will take a percentage (divisible by 10) as input, and the output will be the zipper "unzipped" (dashes separated) ... | [] |
Task
Define a mod-fold as a function of the form f(x) = x % a1 % a2 % … % ak, where the ai are positive integers and k ≥ 0. (Here, % is the left-associative modulo operator.)
Given a list of n integers y0, …, yn−1, determine if there exists a mod-fold f so that each yi = f(i).
You may choose and fix any two outputs Y ... | [] |
I'm new here. I tried seeing if this challenge was introduced before. Found a close call one counting the number of cycles, but didn;t find one for listing them. So I'm writing this one. Sorry if I'm repeating...
Anyway, I'm looking for the shortest function to return all close cycles in a shuffled list of indices. For... | [
[
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... |
A difference pyramid is a pyramid where each new diagonal is the absolute value of the differences between the elements of the last diagonal. For example, if we start with the array
2 5 4 9 3 4
Now, we arrange these in a diagonal column:
2
5
4
9
3
4
Now, we fill in the nex... | [
[
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
]
] |
Summary
Given a list of integers, return the index each integer would end up at when sorted.
For example, if the list was [0,8,-1,5,8], you should return [1,3,0,2,4]. Note that the two 8s maintain their order relative to each other (the sort is stable).
Put another way: For each element in the list, return the number... | [] |
Introduction
Let's observe this array: [3, 2, 4, 1, 1, 5, 1, 2].
Each element displays the length of the substring which must be summed up. Let's take a look at the first element of the above array:
[3, 2, 4, 1, 1, 5, 1, 2]
^
The element at the first index is 3, so we now take a substring of length three with the sam... | [
[
16,
11,
220,
17,
11,
220,
18,
11,
220,
19,
11,
220,
20
]
] |
Task
Given (by any means) a sorted floating point dataset, return (by any means and within 1‰ of the correct value) the interquartile mean.
One possible algorithm
Discard the lowest and highest quarters of the data points.
Calculate the average (sum divided by count) of the remaining data points.
Note: If the dataset... | [] |
The goal of this challenge is to collect selected items in a list and move them to a certain location in the list.
As a visual example, take the input values (represented by black boxed integers) and a corresponding list of truthy values where true denotes the item is selected (represented by blue boxes, where T is tru... | [] |
Given an input of an integer \$n ≥ 2\$, output a list of its divisors sorted by the
exponents in their prime factorizations, in ascending order, ordering first by
the largest prime, then by the second largest, and so on.
As an example, take the integer \$72\$, which is \$2^3\cdot3^2\$. It has
the divisors
1 3^0 · 2... | [] |
An algebraic curve is a certain "1D subset" of the "2D-plane" that can be described as set of zeros {(x,y) in R^2 : f(x,y)=0 }of a polynomial f. Here we consider the 2D-plane as the real plane R^2 such that we can easily imagine what such a curve could look like, basically a thing you can draw with a pencil.
Examples:
... | [] |
Definition
Fibonacci sequence F(n), on the positive integers, are defined as such:
1. F(1) = 1
2. F(2) = 1
3. F(n) = F(n-1) + F(n-2), where n is an integer and n > 2
The Fibonacci-orial of a positive integer is the product of [F(1), F(2), ..., F(n)].
Task
Given positive integer n, find the Fibonacci-orial of n.
Specs
... | [] |
"The Nobel Prize in mathematics was awarded to a California professor who has discovered a new number! The number is bleen, which he claims belongs between 6 and 7." --George Carlin
In this challenge, you will print all Integers, inclusive, within the given input range. Print numbers ascending or descending according... | [] |
Given six unique non-negative integers, print the two 3-digit integers comprised of those numbers that sum to the smallest amount.
Additionally,
If there is more than one set of numbers that meets the smallest-sum requirement, print the two that have the greatest difference. For example, 269 + 157 = 267 + 159 = 426; ... | [] |
The Collatz conjecture is a very well-known conjecture. Take a positive integer; if it's even, divide by 2, else, multiply by 3 and add 1. Repeat until you reach 1 or something else happens. The conjecture is that this process always reaches 1.
You can also reverse the process. Start at 1, multiply by 2, and to branch ... | [] |
Previously, we computed the Bit-Reversal Permutation where we found how the order of indices would be permuted. In that case, we received an input n which was the order of the permutation of the indices where the length was 2n. However, this time, we are given a string of length m = 2k for some k. Now we want to apply ... | [] |
Given an input number n from 1 to 26 (or 0 to 25), output the alphabet reading left-to-right up to and including that corresponding letter, with a=1, b=2, c=3, .... The twist is the letters must also be repeated vertically corresponding to their position in the alphabet. Odd numbers (when 1-indexed) should be balanced ... | [] |
Challenge description
Multiplification (totally not a made-up word) is a process in which you take two positive integers: a and b, and produce another integer which is equal to a repeated ("glued together") b times. For example, multiplifying 3 by 7 gives 3333333. Similarly, 103 multiplified by 5 is 103103103103103.
In... | [] |
Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. However, this is a multiple-holes (common theme is manipulation of data of any type and structure, especially special handling of empty data) code-golf version of the Phase I problems – open to any language. Enjoy!
Objec... | [] |
Executive summary: test whether an input sequence of integers is "admissible", meaning that it doesn't cover all residue classes for any modulus.
What is an "admissible" sequence?
Given an integer m ≥ 2, the residue classes modulo m are just the m possible arithmetic progressions of common difference m. For example, wh... | [] |
A ballot number, which we'll label B, is the number of ways of arranging the numbers from 1 through B(B+1)/2 into a triangle, such that each row and column is in any increasing order. The first four ballot numbers are:
a(0) = 1
a(1) = 1
a(2) = 1
a(3) = 2
a(3) is 2, which means that there are 2 ways of arranging the nu... | [] |
In arithmetic, an n-smooth number, where n is a given prime number, is mathematically defined as a positive integer that has no prime factors greater than n. For example, 42 is 7-smooth because all its prime factors are less than or equal to 7, but 44 is not 7-smooth because it also has 11 as a prime factor.
Define a p... | [] |
OEIS: A167171
A dense number is a number that has exactly as many prime divisors as non-prime divisors (including 1 and itself as divisors). Equivalently, it is either a prime or a product of two distinct primes. The first 100 dense numbers are:
2, 3, 5, 6, 7, 10, 11, 13, 14, 15, 17, 19, 21, 22, 23, 26, 29, 31, 33, 34,... | [] |
"Fit Numbers"
Sam has a "brilliant" idea for compression! Can you help?
Here is a rundown of Sam's compression scheme. First take in a base 10 representation of any natural number strictly smaller than 2^16, and write it as a binary string without any leading zeros.
1 -> 1
9 -> 1001
15 ->1111
13 ->1101
16 -> 10000
17... | [] |
Some people say curiosity killed the cat. Other say it was the box and poison. The RSPCA say Erwin Schrödinger needs to lose the right to own pets.
With animal rights activists outside his house. The cat murderer scientist Schrödinger has finally come up with his greatest invention. A special, radioactive mix of unobta... | [] |
Frank has been working IT his whole life. Each day he responds to tickets, organizes equipment, and reports to his boss. One day, near the closing time on friday, Frank is doing his final inventory and sorting come cables in the supply closet. Suddenly, the door closes and locks from the outside! Such audacity! Frank s... | [] |
Extended Train Swapping Problem
Part 1: Normal Train Swapping Problem
In the 1996 CCC (Canadian Computing Competition), the first Stage 2 problem was a Train Swapping Problem. You can visit the link here. Essentially, you have a bunch of numbered trains, and you want to find out how many train swaps you need to get the... | [] |
Since this SE community is about golfing, I thought a golf-related challenge would be appropriate.
Explanation
Normally, the objective of golf is to finish a hole (and consequently, the entire round) with the least amount of strokes. This is a simple version of golf: Play until you hole the ball and sum up your score. ... | [] |
Introduction
Dice 10,000 is a dice game which can be played with 6 dice and something to write. Players roll the dice multiple times a turn and gain a score at the end of it. The player who reaches 10,000 point first wins the game. Calculating the score of one roll is your job in this challenge.
Look here for the full ... | [
[
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... |
Working with old files from DOS, I found an ancient text animation format, that specify how much time each frame must be shown in the screen. It's very simple:
F1W5F2W3
This example above indicates that Frame 1 must be shown for 5 units of time, and frame 2 for 3 units more. Now I want to convert it to:
1, 1, 1, 1, ... | [] |
In cryptography, PKCS#7 padding is a padding scheme which adds a number of bytes N ≥ 1, where the value of each added byte is equal to N.
For example, Hello, World!, which has 13 bytes, is the following in hex:
48 65 6C 6C 6F 2C 20 57 6F 72 6C 64 21
If we choose to PKCS#7 pad to length 16, then the result is:
48 65 6C... | [] |
It is time to embark on a perilous quest to defeat the British Intelligence. The aim of this challenge is to write the shortest code that will solve a Nonogram.
What is a Nonogram?
The rules are simple.
You have a grid of squares, which must be either filled in black or left blank. Beside each row of the grid are... | [] |
The sequence of segmented numbers or prime numbers of measurement (OEIS A002048) is the sequence of numbers such that each member is the smallest positive (greater than zero) number that can't be made of a sum of earlier consecutive numbers, with a(0) = 1.
Example
To calculate a(7) we first calculate a(0->6) = [1, 2, 4... | [] |
Introduction
The game of xiangqi, also known as Chinese chess, is a chess-like game
popular in China, Vietnam, Taiwan, and other East Asian countries. The colours
of the two sides in xiangqi are red and black. There are seven pieces in
xiangqi: the general (G), advisor (A), elephant (E), horse (H), chariot
(R), cannon ... | [] |
Decipher Neurotic Frogs
Now that Puzzling.SE has finally cracked my amphibian-obsessed cipher, let's write a program or function to decrypt it!
(If you want to look at the puzzle before having it spoiled for you, click the above link now.)
How the cipher works
In Neurotic Frogs Ought To Relax In Mud Baths ("Neurotic F... | [] |
Continued fractions are expressions that describe fractions iteratively. They can be represented graphically:
$$
a_0 +\cfrac 1
{a_1 + \cfrac 1
{a_2 + \cfrac 1
{\ddots + \cfrac 1
{a_n}
}
}
}
$$
Or they can be represented as a list of values: \$[a_0 ; a_1, a_2, \dots, a_n]\$
The challenge:
take a base nu... | [
[
64,
62,
16,
11,
264,
62,
17,
11,
1124,
67816,
11,
264,
1089
]
] |
Write a program or function which will provably print all integers exactly once given infinite time and memory.
Possible outputs could be:
0, 1, -1, 2, -2, 3, -3, 4, -4, …
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, -1, -2, -3, -4, -5, -6, -7, -8, -9, 10, 11, …
This is not a valid output, as this would never enumerate negative num... | [
[
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... |
Challenge
Given a number x and a number n, round number x to n significant figures and output the result.
Significant figures
The significant figures of a number are digits that carry meaning contributing to its measurement resolution. This includes all numbers except leading zeroes.
Bear in mind that leading zeroes af... | [] |
This challenge is the first in a two-challenge series about Repetition. The second will be up soon.
In a language called Repetition (something I just made up), there consists an infinite string of 12345678901234567890..., with 1234567890 repeating forever.
The following syntax is available to output numbers:
+-*/: Thi... | [] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.