# Questions tagged [sequence]

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

934 questions
Filter by
Sorted by
Tagged with
12 votes
5 answers
508 views

### Enumeration of free polyominoes

A polyomino with $n$ cells is a shape consisting of $n$ equal squares connected edge to edge. No free polyomino is the rotation, translation or reflection (or a combination of these ...
• 9,228
11 votes
4 answers
625 views

### Doors and guards

Related but noticeably different You are the leader of the guard in the dungeon of an ancient castle. There are N doors in the dungeon and ...
• 3,383
10 votes
5 answers
612 views

### Record Least Uncommon Multiple Counts

The Greatest Common Divisor, or gcd, of two positive integers $x$ and $y$ is the largest positive integer that divides both $x$ and $y$. The Least Common Multiple, or lcm, of two positive ...
• 1,687
16 votes
7 answers
1k views

### Largest Binary Area

Take the sequence of all natural numbers in binary, (1, 10, 11, ..) then write them vertically beside each-other like this (least significant bit on top; 0s have ...
• 12.5k
7 votes
6 answers
386 views

### Bumping Series Implementation

I have a follow-up question here from my previous question on Math SE. I am lazy enough to explain the content again, so I have used a paraphraser to explain it below: I was considering arbitrary ...
• 1,752
12 votes
18 answers
636 views

### Primes with Distinct Prime Digits

There are 18 primes with distinct prime digits (A124674). Namely, they are: $2, 3, 5, 7, 23, 37, 53, 73, 257, 523, 2357, 2753, 3257, 3527, 5237, 5273, 7253, 7523$ Your task is to output this ...
• 309
18 votes
7 answers
1k views

### Fibonacci Binary Squares

I was playing with the Fibonacci sequence in binary like so (note that the binary representations are written here from smallest bit to largest bit): ...
• 1,687
13 votes
15 answers
1k views

### A Fine sequence with fine interpretations

The ubiquitous Catalan numbers $C_n$ count the number of Dyck paths, sequences of up-steps and down-steps of length $2n$ that start and end on a horizontal line and never go below said line. Many ...
• 3,737
12 votes
6 answers
1k views

### Approximate a root of an odd degree polynomial

Every odd degree polynomial has at least one real root. However this root does not have to be a rational number so your task is to output a sequence of rational numbers that approximates it. Rules ...
• 2,796
17 votes
19 answers
3k views

### Print all pandigital numbers

Given a base as input, output all pan-digital numbers. A number is pan-digital if it includes every digit in that base at least once, possibly multiple times. Every number is considered to contain an ...
• 12.5k
15 votes
18 answers
2k views

### Distance to the average of the next two prime numbers

Suppose we have a sequence $P$. Every element $P_n$ represents the distance between the $n^{th}$ prime number and the average of the next two prime numbers. For example, $P_1$ would be the ...
• 487
22 votes
17 answers
3k views

### Don't repeat yourself

In this challenge you will be tasked with implementing a sequence of natural numbers such that: Each number appears a natural number of times No two numbers appear the same number of times No two ...
• 98.5k
23 votes
36 answers
2k views

• 18k
24 votes
20 answers
2k views

### "Prime" pyramid

The pyramid begins with the row 1 1. We'll call this row 1. For each subsequent row, start with the previous row and insert the current row number between every ...
• 24k
23 votes
29 answers
2k views

### Power sequence differences

Your task Given two positive integers $x$ and $d$ (such that $d<x$), output the 5th term of the $d$th difference of the sequence $n^x$ Example Let's say we are given the inputs $x=4$ ...
• 18k
19 votes
29 answers
2k views

### Length of Binary as Base 10 [OEIS A242347]

Computers like binary. Humans like base 10. Assuming users are humans, why not find the best of both worlds? Your task is to find the first n terms in the sequence ...
• 3,760
30 votes
17 answers
2k views

### Looking back at all the things I said ...

The look-say sequence is a sequence of lists of numbers where each element is the previous element with run length encoding. Run length encoding is the process of grouping together like elements and ...
• 98.5k
19 votes
10 answers
2k views

### Enumerate the rationals

The cardinality of the set $\mathbb Q$ of rational numbers is known to be exactly the same as that of the set $\mathbb Z$ of integers. This means that it is possible to construct a bijection ...
• 20.4k
16 votes
15 answers
2k views

### Generate the n'th Fermi-Dirac Prime

A Fermi-Dirac Prime is a prime power of the form $p^{2^k}$, where $p$ is prime and $k \geq 0$, or in other words, a prime to the power of an integer power of two. They are listed as integer ...
• 1,646
20 votes
7 answers
3k views

### The smallest area of a convex grid polygon

I got an email from Hugo Pfoertner, an Editor-in-Chief at the On-Line Encyclopedia of Integer Sequences, with a terrific idea for a fastest-code challenge, which will also help verify or expand the ...
• 8,679
13 votes
22 answers
1k views

### Even and Odd kinds

Let $n$ be some positive integer. We say that $n$ is of even kind if the prime factorisation of $n$ (counting duplicates) has an even number of integers. For example, $6 = 2 \times 3$ is of ...
• 49.9k
6 votes
5 answers
898 views

### What is the longest trampoline?

In this challenge we are going to consider lists of integers such that for every member $x$ at index $i$ then the indexes $i+x$ and $i-x$ have the value $x+1$ or are out of bounds for the ...
• 98.5k
16 votes
12 answers
1k views

• 76k
12 votes
18 answers
603 views

### Count the number of compositions of $n$ in which the greatest part is odd

A composition of an integer $n$ is a representation of $n$ as a sum of positive integers. For example the eight compositions of 4 are as follows: ...
17 votes
38 answers
3k views

### Calculating π using the Gregory Leibniz series until n terms

based off my previous challenge, this wikipedia article, and a Scratch project Your task: given i, calculate $\pi$ till i ...
• 2,178
21 votes
17 answers
2k views

### Calculate Pi unto a point using the Nilakantha series

Your task: given a nonzero positive number i, calculate pi using the Nilakantha series unto i terms. The Nilakantha series is as ...
• 2,178
14 votes
10 answers
1k views

### IMO Question Six with a difference

In 1988, the International Mathematical Olympiad (IMO) featured this as its final question, Question Six: Let $a$ and $b$ be positive integers such that $ab + 1$ divides $a^2 + b^2$. Show ...
• 106k
-2 votes
3 answers
390 views

### Find the GCD and LCM of a list of numbers [duplicate]

Note: most of the questions that are already in existence about this topic only deal with two numbers as inputs. This question deals with any number (>1) of inputs. GCD The GCD (greatest common ...
• 18k
15 votes
14 answers
5k views

• 48k
17 votes
15 answers
1k views

### Enumerate all pure sets

In set theory, a set is an unordered group of unique elements. A pure set is either the empty set $\{\}$ or a set containing only pure sets, like $\{\{\},\{\{\}\}\}$. Your challenge is to write a ...
• 37.8k
17 votes
15 answers
2k views

### Concatenatable numbers

Given a list of positive integers such as [69, 420], your challenge is to generate the sequence of numbers that can be formed by concatenating numbers from the ...
• 37.8k
15 votes
13 answers
993 views

### Count alternating permutations

An alternating permutation is a permutation of the first $n$ integers $\{ 1 ... n \}$, such that adjacent pairs of values in the permutation alternate between increasing and decreasing (or ...
• 23.7k
18 votes
13 answers
2k views

### Straighten my corners... diagonally

We can arrange the positive integers like this: 1_| 2 | 5 | 10 4___3_| 6 | 11 9___8___7_| 12 16 15 14 13 That is, in L-shaped brackets expanding down and right ...
• 37.8k
10 votes
27 answers
2k views

### Find the nth Fibonacci number, where n is the mth Fibonacci number

Introduction If $\newcommand{\fib}{\operatorname{fib}}\fib(x)$ calculates the $x$th Fibonacci number, write a program that calculates $\fib(\fib(m))$ for any integer value of $m \ge 0$. (Of ...
• 1,580
6 votes
1 answer
670 views

### Irradiated Polyglots

Design a function or program that, when run normally, outputs the triangular numbers. However, when any single character is deleted, the program/function should not function in the original ...
• 1,357