# Questions tagged [sequence]

For challenges involving sequences, typically of numbers following some pattern.

312 questions
Filter by
Sorted by
Tagged with
37k views

### Fibonacci function or sequence

The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first ...
2k 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. ...
7k 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 ...
3k views

### Josephus problem (counting out)

The challenge Write a function that takes two positive integers $n$ and $k$ as arguments and returns the number of the last person remaining out of $n$ after counting out each $k$-th person. ...
10k views

### Am I a Fibonacci Number?

Your Task: Write a program or function to check if a number that is inputted is a Fibonacci number. A Fibonacci number is a number contained in the Fibonacci sequence. The Fibonacci Sequence is ...
3k views

### Different Way Forward

Given a list of integers produce a Forward Difference at a specified order/depth. For the list of integers: (10, 18, -12, 4, 8, -3, -5, 67, 9, 14) The Forward ...
2k 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 ...
4k views

### Generate a Kolakoski sequence [duplicate]

Definition1 A Kolakoski sequence is a self-describing infinite sequence {kn} of alternating blocks of 1's and 2's, given by the following rules: k0 = 1 kn = the length of the (n+1)'th ...
5k views

### Generate Monday Numbers

Monday numbers, as defined by Gamow in this question over on Puzzling, are positive integers N with the following three properties: The decimal representation of N does not contain the digit 0 The ...
9k views

### Look and say sequence [duplicate]

The look and say sequence is a basic form of run length encoding. The sequence starts with the number 1 and each additional number encodes the number of digits that are repeated before each digit ...
975 views

### Return each number from a group of numbers

The challenge The program must return all numbers included into a group (comma and hyphen separated sequence) of numbers. Rules s is the sequence string; all ...
19k views

### One OEIS after another

As of 13/03/2018 16:45 UTC, the winner is answer #345, by Khuldraeseth na'Barya. This means the contest is officially over, but feel free to continue posting answers, just so long as they follow the ...
6k views

### An abundance of integers!

An Abundant number is any number where the sum of its proper divisors is greater than the original number. For example, the proper divisors of 12 are: ...
10k 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 ...
5k views

### Generate Recamán's sequence

Recamán's sequence (A005132) is a mathematical sequence, defined as such: A(0) = 0 A(n) = A(n-1) - n if A(n-1) - n > 0 and is new, else A(n) = A(n-1) + n A ...
4k views

### Flipping pancakes

In pancake sorting the only allowed operation is to reverse the elements of some prefix of the sequence. Or, think of a stack of pancakes: We insert a spatula somewhere in the stack and flip all the ...
5k 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, ...
657 views

### New Order #1: How does this feel?

Introduction Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. ...
768 views

### Counting generalized polyominoes

This challenge will have you count pseudo-polyforms on the snub square tiling. I think that this sequence does not yet exist on the OEIS, so this challenge exists to compute as many terms as possible ...
8k views

### Compute the Kolakoski sequence

This is a repost of an old challenge, in order to adjust the I/O requirements to our recent standards. This is done in an effort to allow more languages to participate in a challenge about this ...
3k views

### Monday Mini-Golf #1: Reverse Fibonacci Solver

Monday Mini-Golf: A series of short code-golf challenges, posted (hopefully!) every Monday. A Fibonacci-like sequence is obtained using the same method as the famous Fibonacci sequence; that is, each ...
4k views

### Generate Dennis Numbers

This challenge is a tribute to PPCG user Dennis for winning the robbers' part of The Programming Language Quiz. Looking at Dennis' PPCG profile page we can see some pretty impressive stuff: He ...
5k views

### Hamming numbers

Hamming numbers are numbers which evenly divide a power of 60. Equivalently, their prime factors are all $\le 5$. Given a positive integer, print that many Hamming numbers, in order. Rules: Input ...
2k views

### Generate n digits of Gijswijt's sequence

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 ...
1k views

### What comes next?

Given a space-separated list of integers, your task is to find the next integer in the sequence. Each integer in the sequence is the result of applying a single mathematical operation(...
4k views

### Female and Male Sequences

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 "...
699 views

### Find the missing number in an undelimited string

The challenge is to identify the missing number in a string of undelimited integers. You are given a string of digits (valid input will match the regular expression ... 970 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 ...
1k views

### Calculate the n-th iterate of a polynomial for a specific value; fⁿ(x)

Given a polynomial function f (e.g. as a list p of real coefficients in ascending or descending order), a non-negative integer n, and a real value x, return:    f n(x) i.e. the value of f (f (f (…f (x)...
2k views

### Partial Sum of Harmonic Sequence!

Definition In Mathematics, Harmonic Sequence refers to a sequence where $$a_n = \frac 1 n$$ i.e. the $n_{th}$ term of the sequence equals the reciprocal of $n$. Introduction In this challenge, ...
837 views

### New Order #2: Turn My Way

Introduction (may be ignored) Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all ...
25k views

### 4, 8, 15, 16, 23, 42 [closed]

4, 8, 15, 16, 23, 42 Write a program that outputs this sequence of numbers infinitely. However, The Numbers must not appear in your source code anywhere. The following is not a valid Java program to ...
4k views

### Fibonacci-orial

Definition Fibonacci sequence F(n), on the positive integers, are defined as such: ...
16k views

### Print numbers from 1 to 10

This might be a very simple challenge, but I am surprised it hasn't been done on code-golf yet: Print all Integers from 1 to 10 inclusive in ascending order to standard output. Your output format ...
8k views

### Count up folks!

Introduction It may sound strange, but we haven't got ONE challenge for counting from 1 to n, inclusive. This is not the same ...
2k views

Perfect License Plates Starting a few years ago, I made myself a little game while driving around: checking if nearby license plates are "perfect". It's relatively rare, but exciting when you find ...
7k views

### Calculate Phi (not Pi)

No, I don't mean $\phi = 1.618...$ and $π = 3.14159...$. I mean the functions. $\phi(x)$ is the number of integers less than or equal to $x$ that are relatively prime to $x$. $π(x)$ is ...
3k views

### Restricted mini challenges Cop's Thread

Robber's thread Your task as cops is to select three things: A programming language An OEIS sequence A byte set You are then to secretly write a program in that language that computes the nth term ...
577 views

### Stealing sequences: Cops

This is cops-and-robbers. This is the Cops thread. For the robbers thread, go here. I've noticed a number of OEIS (On-line Encyclopedia of Integer Sequences) challenges since I joined the site. It ...
5k views

### Is it a Proth number?

A Proth number, named after François Proth, is a number that can be expressed as $$N = k \times 2^n + 1$$ Where $k$ is an odd positive integer and $n$ is a positive integer such that $2^n > k$...
2k views

### Change the Code, Change the Sequence: Cops

This is a cops-and-robbers challenge. For the robbers thread, go here. This challenge involves two OEIS sequences chosen by the cops -- S1, S2 -- and how well those sequences can be golfed and ...
3k views

### Iterated partial sums

The partial sums of a list of integers [a1, a2, a3, ..., an] are s1 = a1 s2 = a1 + a2 s3 = a1 + a2 + a3 ... sn = a1 + a2 + ... + an We can then take the list of partial sums [s1, s2, s3, ..., sn] ...
1k views

### Equality in the sum of digits

Introduction Let's take the number 180. This is an interesting number because the sum of digits of this number is equal to: ...
3k views

### Highly composite numbers

A highly composite number is a positive integer that has more divisors than any smaller positive integer has. This is OEIS sequence A002182. Its first 20 terms are ...
2k views

### Polynomialception

Given two polynomials f,g of arbitrary degree over the integers, your program/function should evaluate the first polynomial in the second polynomial. ...
549 views

### Pack sequences of non-negative integers

Let N be the set of nonnegative integers, i.e. {0, 1, 2, 3, ...}. Let c0(N) be the set of all infinite sequences in N that converge to 0, i.e. { (xn) ∈ NN | xn → 0 as n → ∞}. c0(N)...
6k views

### Numbers with Rotational Symmetry

Given an integer, output a truthy value if it is the same upside-down (rotated 180°) or a falsy value otherwise. 0, 1, and <...
3k 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, ...