For challenges involving some sort of sequence.

learn more… | top users | synonyms

17
votes
15answers
473 views

Find the nth cross-alternate sum

Given an input of a single positive integer, output the "cross-alternate sum" that corresponds to that integer. Take the example of the input n=5. To find the cross-alternate sum, first create a ...
17
votes
8answers
278 views

Print the Super Collatz numbers

The Collatz Sequence (also called the 3x + 1 problem) is where you start with any positive integer, for this example we will use 10, and apply this set of steps to it: if n is even: Divide it by ...
19
votes
16answers
870 views

Rearranging the sequence

Introduction Let's observe the following sequence (non-negative integers): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ... For example, let's take the first three numbers. These are 0, 1, 2. ...
15
votes
13answers
398 views

Say What You See

The "Look and say" or "Say what you see" sequence is a series of numbers where each describes the last. 1 11 (one one) 21 (two ones) 1211 (one two one one) 111221 (one one one two two ones) 312211 ...
16
votes
8answers
569 views

Spiral Permutation Sequence

We can roll up the natural numbers in a rectangular spiral: 17--16--15--14--13 | | 18 5---4---3 12 | | | | 19 6 1---2 11 | | | 20 7---8---9--10 ...
10
votes
6answers
272 views

Squares in the Squares

Given input of a positive integer n, write a program that completes the following process. Find the smallest positive integer greater than n that is a perfect square and is the concatenation of n ...
13
votes
3answers
231 views

Reverse-Engineer the N-Bonacci sequence[s]

In his "Print the N-Bonacci Sequence" challenge, @DJMcGoathem describes the N-bonacci sequences, wherein the previous N numbers are summed, instead of the traditional 2 of the Fibonacci sequence (said ...
22
votes
16answers
2k views

The RATS sequence

Your task is to generate the nth term of the RATS sequence, where n is the input. The RATS sequence is also known as the Reverse Add Then Sort sequence. This sequence can also be found here: ...
19
votes
15answers
1k views

Hypercube elements

Write a function or program that outputs the number of each type of element (vertex, edge, face, etc.) of an N-dimensional hypercube. As an example, the 3 dimensional cube has 1 cell (i.e. 1 ...
21
votes
12answers
768 views

Matching Adjacent Words

In this challenge, you are passed two words: Your job is to determine if they are adjacent. Two letters are adjacent if: They are the same letter, or They are lexicographically adjacent. For ...
20
votes
26answers
7k views

List Prime Numbers [duplicate]

Introduction Prime numbers are simple, right? Well, now you get your chance to find out! Challenge You must write a program or function that takes an input n and outputs the first n prime numbers. ...
19
votes
20answers
2k views

The Möbius Function

The Möbius Function The Möbius function is an important number theoretic function. Your submission should accept a positive integer n and return the value of the Möbius function evaluated at n. ...
5
votes
0answers
129 views

Look and Say sequence in any base

We all already crossed the look and say sequence, and where asked to guess the next element. As its name tells it very well, you just have to say what you see : 1 1 1 2 1 1 2 1 1 1 1 1 2 2 1 3 1 2 2 ...
16
votes
6answers
680 views

Generate Programs in Increasing size

In this challenge, you will write a program which outputs a program which is the double the length of the original program. The outputted program should output a new program a program double its ...
5
votes
0answers
153 views

Help me fill my wallet!

A while ago I purchased a new wallet which is able to hold 8 cards (4 on both side). However, I seem to have way more cards than that and I need to make choices on which ones I want to carry with me. ...
18
votes
7answers
870 views

Find the capacity of 2D printed objects

In a fictional 2D world, a set of 2D printing instructions for an object can be represented by a list of integers as follows: 1 4 2 1 1 2 5 3 4 Each number represents the height of the object at ...
22
votes
5answers
439 views

Fractal Smoke Sequence

Introduction A229037 has a quite intriguing plot (at least for the first few terms): There is the conjecture, that it might indeed have some kind of fractal property. How is this sequence ...
47
votes
9answers
3k views

Surrounded Countries

Countries own a series of territories on a 1D world. Each country is uniquely identified by a number. Ownership of the territories can be represented by a list as follows: 1 1 2 2 1 3 3 2 4 We ...
19
votes
18answers
934 views

Generate the Abacaba sequence

This challenge is about printing the abacaba sequence of a specific depth. Here is a diagram of the first 5 sequences (a(N) is the abacaba sequence of depth N, upper/lowercase is just to show the ...
8
votes
18answers
758 views

Spell out the Revu'a

Actually not inspired neither by Atbash Self Palindromes nor by Generalized Gematria Calculator. Given a string s of length n, output the Revu'a sequence, which is the first character of s, the first ...
39
votes
24answers
4k views

Superstitious hotel elevator

Description Here's a very superstitious hotel elevator in Shanghai:                 It avoids the number 13, because ...
1
vote
2answers
154 views

Find the sequence

The purpose of this challenge is to find the general term of a given arithmetic or geometric sequence. Explanation The formula for an arithmetic sequence is as follows an = a1 + (n-1)d where a1 ...
14
votes
5answers
368 views

Play the word chain

When I was younger, I use to play a word game called Word chain. It was very simple. The first player chooses a word; the next player says another word that starts with the same letter the previous ...
32
votes
25answers
3k views

The Rien Number

The Champernowne constant is a number that is constructed by concatenating the first n numbers, with n tending to infinity. It looks something like this: ...
31
votes
6answers
1k views

Tic-tac-toe with only crosses

Introduction Everyone knows the game tic-tac-toe, but in this challenge, we are going to introduce a little twist. We are only going to use crosses. The first person who places three crosses in a row ...
17
votes
4answers
682 views

Growing Quine Sequence

You are to write a sequence of 10 programs p1 p2 ... p10 that satisfy the following properties: pK prints pK+1 for K from 1 to 9 p10 prints p10 When the first K programs are concatenated, the ...
-2
votes
3answers
129 views

Return prime factorization of a number [duplicate]

Yes, this is old and probably very simple, but I really want to be mindblown by things that I thought were obvious, so here's the challenge: You're given a positive integer as the input and you need ...
16
votes
3answers
289 views

The Abelian Orders

Some background In math, a group is a tuple (G, •) where G is a set and • is an operation on G such that for any two elements x and y in G, x • y is also in G. For some x, y, z in G, basic group ...
17
votes
9answers
405 views

Counting Fountains

A fountain is arrangement of coins in rows so that each coin touches two coins in the row below it, or is in the bottom row, and the bottom row is connected. Here's a 21 coin fountain: Your ...
18
votes
1answer
178 views

Maximal Substring Construction

In this challenge, you are passed two things: A string length, N A list of strings, L, each with an assigned point value. Any string that is not passed in has a point value of 0 You need to ...
18
votes
6answers
347 views

The Kimberling Sequence

Introduction Of course, we've got a lot of sequence challenges, so here is another one. The Kimberling sequence (A007063) goes as following: 1, 3, 5, 4, 10, 7, 15, 8, 20, 9, 18, 24, 31, 14, 28, ...
21
votes
21answers
1k views

Compute the Binary Sierpinski Triangle Sequence

The Binary Sierpinski Triangle sequence is the sequence of numbers whose binary representations give the rows of the Binary Sierpinski Triangle, which is given by starting with a 1 in an infinite row ...
12
votes
9answers
743 views

Pentagonal numbers made from pentagonal numbers

Introduction A pentagonal number (A000326) is generated by the formula Pn= 0.5×(3n2-n). Or you can just count the amount of dots used: You can use the formula, or the gif above to find the first ...
31
votes
6answers
1k views

Have you been nice this year?

Introduction Santa has too many names to process, and needs your help! He needs you to write a program or a function, which outputs nice, naughty, very naughty or very very naughty. To determine how ...
26
votes
13answers
2k views

Motzkin Numbers

The nth Motzkin Number is the number of paths from (0, 0) to (n, 0) where each step is of the form (1, -1), (1, 0) or (1, 1), and the path never goes below y = 0. Here's an illustration of these ...
9
votes
3answers
175 views

Priming a Pristine World

Heavily inspired by Programming a Pristine World. Also closely related to this challenge. Let's define a pristine prime as a number which is itself prime, but will no longer be prime if you remove ...
21
votes
14answers
961 views

Sums of Consecutive Integers

Before anyone says anything, similar and similar. But this is not a dupe. Some positive integers can be written as the sum of at least two consecutive positive integers. For example, 9=2+3+4=4+5. ...
29
votes
31answers
4k views

Catalan Numbers

The Catalan numbers (OEIS) are a sequence of natural numbers often appearing in combinatorics. The nth Catalan number is the number of Dyck words (balanced strings of parenthesis or brackets such as ...
16
votes
6answers
600 views

Converging Sums of a Fractal Sequence

Background A fractal sequence is an integer sequences where you can remove the first occurrence of every integer and end up with the same sequence as before. A very simple such sequence is called ...
16
votes
9answers
1k views

Hilbert Primes Golf

Hilbert numbers are defined as positive integers of the form 4n + 1 for n >= 0. The first few Hilbert numbers are: 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53, 57, 61, 65, 69, 73, 77, 81, ...
16
votes
9answers
541 views

Seven's Cycle Sum Sequence

Take a look at the sevens multiplication table from 7×0 to 7×9: 0, 7, 14, 21, 28, 35, 42, 49, 56, 63 If we just look at the digits in the one's place we get a permutation of the digits ...
10
votes
9answers
544 views

Arithmetic Progressions

Your task is to analyse the input and output the formula for the n-th term if it is an arithmetic sequence, otherwise it should print "NAAP". Input Input (from STDIN) will consist of few numbers, ...
15
votes
29answers
2k views

Write out the Thue-Morse sequence

There's quite a few challenges on this site that ask you to print out a sequence, and this is no exception. (The following explanation of the sequence for this challenge assumes the symbols in the ...
18
votes
16answers
3k views

Bernoulli Numbers

The Bernoulli numbers (specifically, the second Bernoulli numbers) are defined by the following recursive definition: Where denotes a combination. Given a nonnegative integer m as input, output ...
36
votes
19answers
3k views

Triangulating Text

Write a program or function that takes in a string guaranteed to only contain printable ASCII characters except for space, and to be a positive triangular number (1, 3, 6, 10, 15, ...) in length. ...
17
votes
18answers
1k views

Reverse and square

In this challenge you will compute numbers from a curious sequence. Your input is a single decimal nonnegative integer. Reverse the bits in this integer and then square the number to get the required ...
5
votes
10answers
227 views

List numbers within given ranges [duplicate]

Goal: Your goal is to print out numbers within a given range (Also including given values). Input Format: The input will look like: (int-int, int-int, ...) ... meaning the user can add as many ...
15
votes
3answers
665 views

A Mapping of Primes

Recently, I have found a bijective mapping f from positive integers to finite, nested sequences. The purpose of this challenge is to implement it in the language of your choice. The Mapping Consider ...
27
votes
15answers
3k views

Trump needs your help to stop the Starman!

A man from the stars has come to Earth! Luckily the president of the United States, Donald Trump, has an infinity-sided die. Using this die, he can conjure up a number which you, the mayor of Podunk, ...
15
votes
8answers
1k views

Digital Cellular Automata

Write a program or function that takes in an odd positive integer N and a string of decimal digits (0123456789). The string represents a ten-state one-dimensional cellular automaton. Each digit ...