Questions tagged [sequence]
For challenges involving sequences, typically of numbers following some pattern.
841
questions
16
votes
15
answers
1k
views
Generalise perfect numbers
Let \$\sigma(n)\$ represent the divisor sum of \$n\$ and \$\sigma^m(n)\$ represent the repeated application of the divisor function \$m\$ times.
Perfect numbers are numbers whose divisor sum equals ...
18
votes
7
answers
1k
views
Square root multiples
This code-challenge is based on OEIS sequence A261865.
\$A261865(n)\$ is the least integer \$k\$ such that some multiple of \$\sqrt{k}\$ is in the interval \$(n,n+1)\$.
The goal of this challenge is ...
16
votes
2
answers
501
views
Count unrooted, unlabeled binary trees of n nodes
An unrooted binary tree is an unrooted tree (a graph that has single connected component and contains no cycles) where each vertex has exactly one or three neighbors. It is used in bioinformatics to ...
20
votes
20
answers
2k
views
Fibonacci trees
Background
Fibonacci trees \$T_n\$ are a sequence of rooted binary trees of height \$n-1\$. They are defined as follows:
\$T_0\$ has no nodes.
\$T_1\$ has a single node (the root).
The root node of \$...
13
votes
21
answers
1k
views
Get the length of a Sumac Sequence
Heavily based on this closed challenge.
Codidact post, Sandbox
Description
A Sumac sequence starts with two non-zero integers \$t_1\$ and \$t_2.\$
The next term, \$t_3 = t_1 - t_2\$
More generally, \$...
10
votes
15
answers
1k
views
Merge Two Paragraphs with Removing Duplicated Lines
Challenge
The goal of this challenge is to make a function that takes two paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy (but a single copy ...
14
votes
20
answers
2k
views
Linear integer function generator
Inspired by a recent challenge involving Fibonacci numbers in which OEIS was mentioned, I would like to present a challenge of creating a function that generates a wide array of different linear ...
18
votes
5
answers
1k
views
Find a sequence in the binary digits of π
Given a binary sequence of finite length, find the starting position where this sequence first appears in the binary digits of π (after the decimal). You can assume that an answer exists for any input ...
18
votes
27
answers
1k
views
Output a unique sign sequence
A sign sequence is an infinite sequence consisting entirely of \$1\$ and \$-1\$. These can be constructed a number of ways, for example:
Alternating signs: \$1, -1, 1, -1, ...\$
\$-1\$ for primes, \$...
28
votes
18
answers
2k
views
Pascal's Fibonacci Triangle
What do you get when you cross Pascal's Triangle and the Fibonacci sequence? Well, that's what you have to find out!
Task
Create a triangle that looks like this:
...
20
votes
28
answers
1k
views
Partial sums of the Kempner series
The Kempner series is a series that sums the inverse of all positive integers that don't contain a "9" in their base-10 representations (i.e., \$\frac{1}{1} + \frac{1}{2} + \frac{1}{3} + .. +...
9
votes
8
answers
286
views
Squarefree Palindromes [closed]
Create the shortest function, program, or expression that calculates a sequence of squarefree palindromic numbers.
A squarefree number is one which is not evenly divisible by a square number (i.e. ...
38
votes
37
answers
2k
views
Ken Iverson’s Favourite APL Expression?
Ken Iverson, 1920–2020
Let's implement his favourite expression:
Given a row of Pascal's triangle, compute the next row.
This can for example be computed by taking the input padded with a zero on the ...
22
votes
27
answers
2k
views
Perfect radicals
Given a positive integer number \$n\$ output its perfect radical.
Definition
A perfect radical \$r\$ of a positive integer \$n\$ is the lowest integer root of \$n\$ of any index \$i\$:
$$r = \sqrt[i]{...
32
votes
51
answers
4k
views
Multiply or Divide by n
Here's a simple challenge, so hopefully lots of languages will be able to participate.
Given a positive integer \$n\$, output \$A076039(n)\$ from the OEIS.
That is, start with \$a(1)=1\$. Then for \$n&...
16
votes
14
answers
1k
views
Centerless Polygons
A centered polygonal number is a positive integer given by the number of vertices when a point is surrounded by (increasingly larger) polygons with the same number of sides, as shown below. For ...
18
votes
13
answers
1k
views
All-inclusive semi-primes
\$723 = 3 \times 241\$ is a semi-prime (the product of two primes) whose prime factors include all digits from \$1\$ to \$n\$, where \$n\$ is the total number of digits between them. Another way to ...
16
votes
1
answer
483
views
Total resistance from unit resistors
This problem is based on, A337517, the most recent OEIS sequence with the keyword "nice".
\$a(n)\$ is the number of distinct resistances that can be produced from a circuit with exactly \$n\...
26
votes
30
answers
2k
views
Not so triangular numbers
Let's consider the sequence \$S\$ consisting of one \$1\$ and one \$0\$, followed by two \$1\$'s and two \$0\$'s, and so on:
$$1,0,1,1,0,0,1,1,1,0,0,0,1,1,1,1,0,0,0,0,...$$
(This is A118175: Binary ...
18
votes
19
answers
2k
views
The Fibonacci Rectangular Prism Sequence
What is the Fibonacci Rectangular Prism Sequence?
The Fibonacci Rectangular Prism Sequence is a sequence derived from the Fibonacci sequence starting with one. The first 3 numbers of the Fibonacci ...
15
votes
1
answer
279
views
Polygons in a cube
Inspired in part by this
Mathologer video on gorgeous visual "shrink" proofs, and my general interest in the topic, this challenge will have you count regular polygons with integer ...
18
votes
7
answers
840
views
What valence does this APL train have?
Context
In APL, trains are tacit sequences of monadic/dyadic functions that can be called with one or two arguments. We'll code something to check if a given train follows the correct structure we ...
26
votes
10
answers
3k
views
The square root of the square root of the square root of the…
This code-golf challenge will give you an integer n, and ask you to count the number of positive integer sequences \$S = (a_1, a_2, \dots, a_t)\$ such that
\$a_1 + ...
18
votes
5
answers
527
views
Triangles with rational side lengths
This challenge will have give you a positive integer \$n\$ and ask you to output \$t(n)\$, the number of triangles (up to congruence) satisfying the three conditions:
The triangles have perimeter of ...
18
votes
23
answers
2k
views
Create an Accurate How-To Article
Here is an easy-intermediate challenge for anyone interested!
What is that?
A thing me and brother do a bit too often is this:
One of us has a problem and asks the other to explain how to do certain ...
23
votes
20
answers
1k
views
Sequences of distinct positive integers
The goal of this challenge is to take a positive integer n and output (in lexicographic order) all sequences \$S = [a_1, a_2, ..., a_t]\$ of distinct positive ...
25
votes
2
answers
1k
views
Extend the most recent "nice" OEIS sequence: stepping stone puzzle on a grid
Today Neil Sloane of the OEIS sent out an email asking for a confirmation of the current terms, and computation of some larger terms of the latest OEIS sequence A337663 with the keyword "nice&...
2
votes
0
answers
105
views
Grow in a slow-growing sequence [duplicate]
Background
There is an interesting question on MathSE about some conjectures that are disproven by extremely large counter-examples. This delightful answer tells the story of a sequence of numbers ...
23
votes
16
answers
2k
views
Delicate primes
Inspired by Find the largest fragile prime.
By removing at least 1 digit from a positive integer, we can get a different non-negative integer. Note that this is different to the ...
31
votes
26
answers
3k
views
Implement the random Fibonacci sequence
The random Fibonacci sequence is defined as follows:
$$
f_n =
\begin{cases}
f_{n-1}+f_{n-2} \text{ with probability } 1/2 \\
f_{n-1}-f_{n-2} \text{ with probability } 1/2 \\
\end{cases}
$$
$$
f_1 = ...
36
votes
99
answers
4k
views
Lolololololololololololol
Let us take a break from the brain-wrecking questions and answer some of the simpler ones
You have recently read something extremely funny, and want to express your laughter to the world! But how can ...
24
votes
33
answers
3k
views
Find the largest banknote
Banknotes in many countries come in denominations of 1,2,5,10,20,50,100,200,500,1000, etc. That is, one of \$ \{ 1,2,5\} \$ times a power of \$10\$. This is OEIS A051109, except we'll extend the ...
9
votes
14
answers
818
views
Descending dungeons of positional systems
The sequence discussed in this challenge is a variant of the Descending Dungeons sequence family. Specifically, the sequence generation rules:
...
-5
votes
2
answers
190
views
Solve the dress problem [closed]
Background
Peter's Father, the Teacher of a dance-club, asks Peter a question:
Given are two natural numbers (\$\mathbb{N}\$ \$x\$ and \$y\$).
\$x\$ is the number of the garment types (e.g. shorts, ...
9
votes
8
answers
1k
views
Pascal's tree-angle
Print this tree:
...
10
votes
10
answers
2k
views
Lumberjaxe Code Golf
Tom the lumberjack is going to do his daily routine: chop trees. After all, it's his job to do so. His boss has ordered him to chop trees in a straight line marked with a special tape to identify them,...
5
votes
8
answers
267
views
Is it a geometric sequence or not? [closed]
Well, last time I asked for an arithmetic sequence, now comes the geometric sequence
Challenge
In this challenge, the input will be an unordered set of numbers and the program should be able to tell ...
-7
votes
4
answers
229
views
Is it an Arithmetic Sequence or not? [closed]
Challenge
In this challenge, the input will be an ordered set of numbers and the program should be able to tell if the set of numbers is an Arithmetic Sequence.
Input
The input will be a list ...
12
votes
3
answers
781
views
Metagolf the OEIS
We've had Meta Regex Golf and Display OEIS Sequences. Now, it is time for Meta OEIS Golf.
Challenge
Given a sequence of integers, your program/function should output a program/function in the same ...
12
votes
3
answers
284
views
Friendly Incenters
The incenter of a triangle is the intersection of the triangle's angle bisectors. This is somewhat complicated, but the coordinate formula for incenter is pretty simple (reference). The specifics of ...
14
votes
5
answers
656
views
Placing Dominoes On A Chequerboard
How many ways can one place (unlabelled) dominoes on a square chequerboard such that the number placed horizontally is equal to the number placed vertically?
The dominoes must align with, and may not ...
25
votes
24
answers
2k
views
Complete a sequence using its distances
Given \$A = (a_1,\dots,a_k)\ k\ge2 \$ a sequence of positive integers, in which all elements are different.
Starting from \$i=2\$, while \$a_i\in A:\$ (until the last element)
If \$d=|a_i-a_{i-1}|\$ ...
13
votes
10
answers
910
views
Find all Belphegor primes
A Belphegor number is a number of the form \$(10^{n+3}+666)*10^{n+1}+1\$ (1{n zeroes}666{n zeroes}1) where \$n\$ is an non-negative integer. A Belphegor prime is a ...
9
votes
3
answers
504
views
Number of tilings on a triangular board with triangular tiles
Background
Consider the shape \$T(n)\$ consisting of a triangular array of \$\frac{n(n+1)}{2}\$ unit regular hexagons:
John Conway proved that \$n = 12k + 0,2,9,11\$ if and only if \$T(n)\$ can be ...
11
votes
3
answers
515
views
Triangles in a tetrahedron
The goal of this challenge is to extend the OEIS sequence A334581.
Number of ways to choose \$3\$ points that form an equilateral triangle from the \$\binom{n+2}{3}\$ points in a regular tetrahedral ...
12
votes
10
answers
2k
views
The "skip-pure" numbers
The skip-pure numbers are defined with this rule:
...
24
votes
11
answers
2k
views
Generate A065825
(This is A065825.) The sequence defaults apply, so you can pick another format other than this one.
Given an input integer n, find the smallest number ...
13
votes
3
answers
531
views
How much weight can you lift?
With all the gyms closed down with the COVID-19 situation, we have to exercise with the weight we have lying around at home. The problem is, we have a small selection of plates at varying weights, and ...
22
votes
15
answers
2k
views
Donation arms race
The barfoos, a hypothetical alien species, go about charity in an interesting way.
Every morning, barfoo Specialists come up with an ordered list of causes to donate to, and for each cause they ...
18
votes
9
answers
2k
views
Missile-mounted cameras
You are employed as Administrator in charge of Road Maintenance and Planning. The intelligence division of the Agency for Road Maintenance and Planning has come up with a brilliant and not at all ...