# Questions tagged [sequence]

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

855 questions
Filter by
Sorted by
Tagged with
491 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: ...
• 1,101
2k views

### Calculating Pi 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 ...
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 ...
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 ...
• 93.9k
157 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 ...
• 708
4k views

• 37.5k
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 ...
• 31.9k
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 ...
• 31.9k
773 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 ...
• 22.6k
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 ...
• 31.9k
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 ...
• 195
567 views

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,306
2k views

### Palindromic Powers

Powers We define an important power as a number that can be represented as $x^y$ where $x ≥ 2$ and $y ≥ 2$. Palindrome We define an ...
• 1,466
2k views

### Infinite Candle Sequence

I have a cake shop that specialises in birthday cakes. The cakes that I sell must have candles placed in a circle. You would probably think I can just divide 360° by the number of candles, but the ...
• 2,137
973 views

### Sequence of integers not the sum of powers of earlier terms

Starting with 1, output the sequence of integers which cannot be represented as the sum of powers of earlier terms. Each previous term can be used at most once, and the exponents must be non-negative ...
• 420
2k views

### The Binary Eyes

A binary eye is an odd set of digits, with all of its digits except the center one set to 1 or 0, and the center one set to the opposite of the others. Thus, there are two binary eyes for a given odd ...
• 420
3k views

• 1,805
1k views

### How many blocks make a "truncated square-pyramid garden"?

A truncated square-pyramid of height $h$ has $h$ square layers where each layer has a side $1$ greater than the one above it, apart from the top layer which is a square of blocks with a given ...
• 93.9k
801 views

### All sequences as substrings

Make a program that outputs a sequence of integers so that every finite sequence of positive integers is a substring (continuous subsequence) of the output. For example, the following sequence ...
• 6,775
578 views

### Probability breaking sequences

If we have a finite list of elements we can determine the probability of any one element being drawn at random as the number of times it occurs divided by the total number of elements in the list. For ...
• 90.4k
1k views

### Square-free words of a length

A square-free word is a word consisting of arbitrary symbols where the pattern $XX$ (for an arbitrary non-empty word $X$) does not appear. This pattern is termed a "square". For example, ...
2k views

### Output every sublist ... eventually

You will be given as input an infinite stream of positive integers. Your task is to write a program which outputs an infinite sequence of lists with two requirements: All lists in the output are ...
• 90.4k
346 views

### Universal Command Sequence

Universal Command Sequence Definition An $n$-maze is a $n\times n$ chessboard which has "walls" on some edges, and a "king" on the board that can move to the 4 adjacent cells, ...
772 views

### Generate Fmbalbuena Numbers

My user id is 106959 How to check if the number is Fmbalbuena number? First Step: Check if the number of digits is a multiple of 3: ...
• 2,555
1k views

### Slater-Velez permutation

Let's build a sequence of positive integers. The rule will be that the next number will be the smallest number which: It hasn't already appeared in the sequence Its absolute difference from the ...
• 90.4k
152 views

### Indices of square numbers that are also pentagonal [closed]

First 15 numbers of the A046173: ...
• 3,049
751 views

### Mutually recursive lists

Let's define a simple function $f$ which takes an integer and produces a list: $f(n) = [g(1),g(2),\dots,g(n)] \\ g(n) = [f(0),f(1),\dots,f(n-1)]$ We can then calculate the first couple of values ...
• 90.4k
2k views

### Next Greater Number

Given an integer n, find the next number that follows the following requirements The next greater number is a number where each digit, from left to right, is ...
• 3,049
1k views

### Number of complete rhyme schemes

A rhyme scheme is the pattern of rhymes at the end of the lines in a poem. They are typically represented using letters, like ABAB. We consider two rhyme schemes ...
• 22.6k
633 views

### Counting universal n-ary logic gates

Background A classical logic gate is an idealized electronic device implementing a Boolean function, i.e. one that takes a certain number of Boolean inputs and outputs a Boolean. We only consider two-...
• 66.1k
2k views

### An ASCII self-referential sequence

The sequence A109648 starts with the following numbers ...
• 66.1k
221 views

### Multiplicity of Shared Totients

Euler's totient function, $\varphi(n)$, counts the number of integers $1 \le k \le n$ such that $\gcd(k, n) = 1$. For example, $\varphi(9) = 6$ as $1,2,4,5,7,8$ are all coprime to $9$. ...
471 views

### The Most Wanted Prime Numbers

Output a sequence of all the primes that are of the following form: 123...91011...(n-1)n(n-1)..11109...321. That is, ascending decimal numbers up to some ...
• 6,775
1k views

### Nth FizzBuzz Number

Introduction Everyone knows the FizzBuzz sequence. It goes something like this: 1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz . . . In case you don't ...
• 3,129