Skip to main content

Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
21 votes
17 answers
1k views

I was looking for a simple sequence that's not yet referenced on the OEIS and came up with this one(*): \$a_1=2\$ \$a_2=3\$ For \$n>2\$, \$a_n\$ is the smallest number of the form \$a_i\times a_j+...
Arnauld's user avatar
  • 206k
15 votes
17 answers
2k views

Problem 4 of the 2025 International Mathematical Olympiad asked (paraphrased): Let \$f(n)\$ be the sum of the largest three proper divisors of \$n\$, that is divisors excluding \$n\$ itself. For ...
xnor's user avatar
  • 150k
-5 votes
4 answers
236 views

Given an HTTP/1.1 POST request represented as a buffer (e.g., Uint8Array; uint8_t) of bytes, ...
guest271314's user avatar
9 votes
4 answers
667 views

A text that can be arranged triangularly in some fashion can be read back in some other fashion effectively enciphering it. Narrowing down a set of plausible triangular numberings allows to ...
Domenico's user avatar
  • 2,463
9 votes
2 answers
343 views

In this code-golf challenge, you will count the number of ways of putting together pieces of a building toy which consists of slotted squares that interlock with one another, shown below. In ...
Peter Kagey's user avatar
  • 8,165
16 votes
17 answers
1k views

Echo numbers (A383896) are positive integers k such that the largest prime factor of k-1 is a suffix of ...
ZaMoC's user avatar
  • 25.5k
13 votes
18 answers
2k views

A046386 is the sequence of all natural numbers that are the product of exactly 4 distinct primes. Write the shortest program, function, or code snippet, that, when given a natural number, outputs ...
bigyihsuan's user avatar
  • 11.5k
9 votes
1 answer
384 views

In this code-golf challenge, you will work with a construction that was used by the ancient Greeks: the straightedge-and-compass construction. In particular, you will count how many different ...
Peter Kagey's user avatar
  • 8,165
9 votes
15 answers
1k views

I have been studying how to compress the Dis programs into their equvalent ones. One of the possibly easiest subset is programs with only } and ...
IY5dVSjABEeV's user avatar
  • 1,277
16 votes
17 answers
1k views

OEIS A135404 gives the number of Gessel walks \$g(n)\$ of length \$2n\$. A Gessel walk is a walk on the square lattice starting and ending at the origin with possible steps (1,0), (-1,0), (1,1), (-1,-...
Parcly Taxel's user avatar
  • 4,749
16 votes
12 answers
993 views

Given an alphabet size, \$n>0\$, and an occurrence limit, \$k>0\$, produce the number, \$a(n, k)\$, of strings that may be constructed from the \$n\$ letters in the alphabet which have no more ...
Jonathan Allan's user avatar
17 votes
20 answers
2k views

A 1D go position on a board of size n is a sequence of length n consisting of the numbers0, <...
Lucenaposition's user avatar
15 votes
9 answers
1k views

Given a positive integer \$n\$, a partition of \$n\$ is an ascending sequence of numbers that sum to \$n\$. Given two partitions \$a\$ and \$b\$, \$a\$ is a refinement of \$b\$ iff \$b\$ can be ...
Wheat Wizard's user avatar
  • 103k
13 votes
13 answers
2k views

The easiest way to understand this task is to look at this graph, which you can change interactively. It defines a sequence n -> a(n) like this: a(0) = 0; thereafter a(n) is the least integer (in ...
Sophia Antipolis's user avatar
14 votes
11 answers
1k views

A Rota-Baxter word, \$w\$, is a string made of the symbols a, (, and ) such that the ...
Wheat Wizard's user avatar
  • 103k
7 votes
7 answers
512 views

Related CodeGolf posts How many unique one sided polyominos Enumeration of free polyominoes Context From Wikipedia: A polyomino is a plane geometric figure formed by joining one or more equal ...
138 Aspen's user avatar
  • 7,257
2 votes
11 answers
824 views

Narrative We are standing at the foot of a mountain. To find the best route when climbing the mountain, let's consider all possible routes. On our route, there is no point lower than our starting ...
Sophia Antipolis's user avatar
15 votes
10 answers
2k views

Narrative Recently, I visited Nice (a French city on the Mediterranean coast) and saw a curious tourist wandering through the city. His walk started at the center of the 'Promenade des Anglais'. He ...
Sophia Antipolis's user avatar
12 votes
6 answers
2k views

Consider binary strings (reading from left to right) starting with a '1' as ponds of lily pads. A '1' signifies a frog sitting on the lily pad, and a '0' represents an empty lily pad. Here, we see a ...
Sophia Antipolis's user avatar
7 votes
6 answers
408 views

A walk on a circle is a sequence of oriented arcs of equal length on a circle starting and ending at the same point. The endpoint of an arc is always the starting point of the next arc of the walk. ...
Sophia Antipolis's user avatar
12 votes
10 answers
2k views

Donald Knuth describes the setup: "There are \$n\$ girls \${g_1, ..., g_n}\$ and \$k\$ boys \${b_1, ..., b_k}\$, where \$g_i\$ is younger than \$g_{i+1}\$ and \$b_j\$ is younger than \$b_{j+1}\$, ...
Sophia Antipolis's user avatar
17 votes
10 answers
2k views

This is the outline of this challenge: Every number greater than or equal to two has a prime factorization. A prime factorization can be represented as a bar graph. Every bar graph has a water ...
Sophia Antipolis's user avatar
7 votes
2 answers
557 views

Update: 8x8 case from @gsitcia has finished! according to that code, there are 162,403,827,553,180,928 ways it could be folded. now to get it into the oeis... Inspired by this recent video, I figured ...
user119818's user avatar
  • 1,631
11 votes
7 answers
2k views

Definitions: A sparse ruler, or simply a ruler, is a strict increasing finite sequence of nonnegative integers starting from 0, called marks. A ruler is complete if the set of all distances it can ...
Sophia Antipolis's user avatar
8 votes
5 answers
434 views

Consider boxes stacked on top of each other. Boxes on the bottom row are labeled 1. Boxes not on the bottom row must be supported directly below, and are labeled as the sum of the 2 or 3 boxes they ...
Sophia Antipolis's user avatar
11 votes
13 answers
1k views

For prime p, the factorization tree is a single vertex in just one way so that a(p) = 1. For composite n, the two subtrees at n are a split of n into two factors n = d * (n/d), without order, so that $...
Sophia Antipolis's user avatar
7 votes
12 answers
816 views

Challenge: Write a program or function that, given positive integers n, t, b, c, counts permutations of 1..n where: Exactly t numbers are in their original position Exactly b numbers are higher than ...
Peter Thomas's user avatar
-1 votes
1 answer
191 views

Inspired by this problem. Golomb's self-describing sequence g(n) is a sequence where any natural number n is repeated within the sequence g(n) times. Given an input of \$ n \$, output: $$ \left( \sum_{...
shlby696's user avatar
7 votes
8 answers
439 views

In mathematics, a Padé approximant (Wikipedia, MathWorld) is the "best" approximation of a function by a rational function. For a function \$f(x)\$, the Padé approximant of order \$[m/n]\$ ...
alephalpha's user avatar
  • 51.9k
7 votes
6 answers
451 views

It happened in the 19th century. Georg was bored and started counting the rational numbers. Surprisingly, he discovered that there were no more of them than natural numbers. This insight made Georg ...
Sophia Antipolis's user avatar
18 votes
11 answers
2k views

One way to approximate π is the following: Start by drawing a 2x2 square with a quarter-circle in it. Then, the area of the quarter-circle is π. We can approximate this area by filling it with ...
emanresu A's user avatar
  • 46.2k
11 votes
10 answers
2k views

Let p, q, and c := (p + q)"q (where " denotes concatenation) be positive integers such that p and c are primes and q is the smallest prime such that c is prime. Such a prime triple (p, q, (p ...
Sophia Antipolis's user avatar
8 votes
6 answers
1k views

The number of unlabeled rooted trees with n nodes is a fundamental sequence in graph theory and in discrete mathematics in general. Some authors call these trees 'Polya trees'. The number of these ...
Sophia Antipolis's user avatar
15 votes
10 answers
1k views

Sylvester's sequence can be defined recursively S(n) = S(n-1)*(S(n-1) + 1) for n >= 1 starting S(0) = 1. Since S(n) and S(n) + 1 have no common divisors, it follows that S(n) has at least one more ...
Sophia Antipolis's user avatar
15 votes
15 answers
2k views

Consider the infinite table of the nonnegative integers with width 12: ...
noodle person's user avatar
20 votes
21 answers
1k views

In 1995, Stanley Rabinowitz and Stan Wagon found an interesting algorithm to generate the digits of \$\pi\$ one by one without storing the previous results. The algorithm is called the spigot ...
alephalpha's user avatar
  • 51.9k
2 votes
3 answers
343 views

Given integers \$a,b,m, k, n\$ and array \$F = (f_1, f_2,...,f_n)\$ defined as: \begin{cases} f_1 = \text{a}\\ f_2 = \text{b}\\ f_i = (f_{i-1} + f_{i-2}) \text{ mod m},∀i > 2 \end{cases} When \$F\$ ...
TruongVi's user avatar
  • 121
14 votes
5 answers
541 views

In group theory, the free group with \$n\$ generators can be obtained by taking \$n\$ distinct symbols (let's call them \$a, b, c ...\$ etc), along with their inverses \$ a^{-1},b^{-1},c^{-1} ...\$ . ...
emanresu A's user avatar
  • 46.2k
18 votes
28 answers
2k views

The sequence of Harmonic numbers are the sums of the reciprocals of the first k natural numbers (not including zero): \${\displaystyle H_{k}=1+{\frac {1}{2}}+{\frac {1}{3}}+\cdots +{\frac {1}{k}}=\sum ...
noodle person's user avatar
20 votes
23 answers
2k views

Goal Write a program that outputs this list: ...
12431234123412341234123's user avatar
15 votes
2 answers
463 views

Background A167519: Lexicographically earliest increasing sequence which lists the positions of the zero digits in the sequence. ...
Bubbler's user avatar
  • 79.3k
16 votes
6 answers
1k views

The Mahler-Popken complexity, \$C(N)\$, of a positive integer, \$N\$, is the smallest number of ones (\$1\$) that can be used to form \$N\$ in a mathematical expression using only the integer* \$1\$ ...
Jonathan Allan's user avatar
14 votes
13 answers
1k views

Task Output the sequence that precisely consists of the following integers in increasing order: the 2nd and higher powers of 10 (\$10^i\$ where \$i \ge 2\$), the squares of powers of 10 times 2 or 3 (...
Bubbler's user avatar
  • 79.3k
14 votes
10 answers
1k views

related For this challenge, we'll be using a simplified dialect of regular expressions, where: A lowercase letter from a to z ...
emanresu A's user avatar
  • 46.2k
11 votes
4 answers
2k views

Follow-up of my previous challenge, inspired by @emanresu A's question, and proven possible by @att (Mathematica solution linked) For the purposes of this challenge, a 1-2-3-5-7... sequence is an ...
Tbw's user avatar
  • 3,043
22 votes
15 answers
2k views

For the purposes of this challenge, a 1-2-3 sequence is an infinite sequence of increasing positive integers such that for any positive integer \$n\$, exactly one of \$n, 2n,\$ and \$3n\$ appears in ...
Tbw's user avatar
  • 3,043
13 votes
12 answers
2k views

Given a prime number \$p\$ output the asymptotic density of the set of positive integers which have \$p\$ as their second-smallest distinct prime factor Input/Output Input: one of the following ...
Mukundan314's user avatar
  • 13.7k
2 votes
3 answers
258 views

In the poker game there are 1277 unique 'High Card' ranks. It's 1287 (13 over 5) if we include all straights. The challenge is to write a function which returns an integer value corresponding to the ...
Ziarek's user avatar
  • 123
14 votes
7 answers
2k views

If I want to type the string aaa, the least keystrokes I can type it in is 3: a a a. But if I want to type the string ...
emanresu A's user avatar
  • 46.2k
15 votes
16 answers
1k views

Imagine you have a positive integer number \$n\$. Let \$m\$ be the number obtained by reversing \$n\$'s digits. If \$m\$ is a whole multiple of \$n\$, then \$n\$ is said to be a reverse divisible ...
Trivaxy's user avatar
  • 697

1
2 3 4 5
20