Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
15 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 ...
Michael Stern's user avatar
18 votes
5 answers
2k 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 ...
Roman's user avatar
  • 1,993
18 votes
28 answers
2k 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, \$...
caird coinheringaahin g's user avatar
31 votes
18 answers
3k 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: ...
user's user avatar
  • 327
21 votes
29 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} + .. +...
Command Master's user avatar
9 votes
8 answers
366 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. ...
Neel Shukla's user avatar
40 votes
38 answers
3k 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 ...
Adám's user avatar
  • 30.2k
23 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]{...
AZTECCO's user avatar
  • 10.8k
33 votes
52 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&...
Giuseppe's user avatar
  • 28.6k
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 ...
Peter Kagey's user avatar
  • 8,679
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 ...
caird coinheringaahin g's user avatar
16 votes
1 answer
518 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\...
Peter Kagey's user avatar
  • 8,679
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 ...
Arnauld's user avatar
  • 192k
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 ...
nthnchu's user avatar
  • 399
15 votes
1 answer
327 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 ...
Peter Kagey's user avatar
  • 8,679
18 votes
7 answers
876 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 ...
RGS's user avatar
  • 14.1k
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 + ...
Peter Kagey's user avatar
  • 8,679
18 votes
5 answers
549 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 ...
Peter Kagey's user avatar
  • 8,679
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 ...
SunnyMoon's user avatar
  • 2,689
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 ...
Peter Kagey's user avatar
  • 8,679
26 votes
2 answers
2k 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&...
Peter Kagey's user avatar
  • 8,679
2 votes
0 answers
108 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 ...
polfosol ఠ_ఠ's user avatar
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 ...
caird coinheringaahin g's user avatar
31 votes
27 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 = ...
caird coinheringaahin g's user avatar
39 votes
128 answers
5k 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 ...
SunnyMoon's user avatar
  • 2,689
28 votes
36 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 ...
Anthony Faull's user avatar
9 votes
14 answers
825 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: ...
AndrewTheCodegolfer's user avatar
-6 votes
2 answers
202 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, ...
math scat's user avatar
  • 9,228
9 votes
8 answers
1k views

Pascal's tree-angle

Print this tree: ...
Nip Dip's user avatar
  • 415
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,...
Nip Dip's user avatar
  • 415
5 votes
8 answers
284 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 ...
math scat's user avatar
  • 9,228
-8 votes
4 answers
257 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 ...
math scat's user avatar
  • 9,228
12 votes
3 answers
833 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 ...
fireflame241's user avatar
  • 16.3k
12 votes
3 answers
291 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 ...
fireflame241's user avatar
  • 16.3k
14 votes
5 answers
660 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 ...
Jonathan Allan's user avatar
26 votes
27 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}|\$ ...
Domenico's user avatar
  • 2,273
14 votes
11 answers
1k 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 ...
Mukundan314's user avatar
  • 10.6k
9 votes
3 answers
550 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 ...
Bubbler's user avatar
  • 76k
11 votes
3 answers
561 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 ...
Peter Kagey's user avatar
  • 8,679
12 votes
10 answers
2k views

The "skip-pure" numbers

The skip-pure numbers are defined with this rule: ...
AndrewTheCodegolfer's user avatar
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 ...
user avatar
13 votes
3 answers
569 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 ...
Josue Espinosa's user avatar
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 ...
lightlyheld's user avatar
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 ...
lightlyheld's user avatar
10 votes
1 answer
895 views

Infinite Snake game

Infinite Snake is just like the video game Snake, except for that the snake is infinitely long, there are no items to eat, and the Snake needs to move in a repeating ...
Peter Kagey's user avatar
  • 8,679
23 votes
53 answers
2k views

Generate list of numbers and their negative counterparts

A recent SO question asks for a convenient one-liner to generate a list of numbers and their negative counterparts in Python. Given two integers \$1≤a≤b\$, generate all the integers \$x\$ such that \$...
Adám's user avatar
  • 30.2k
16 votes
5 answers
727 views

Conway's $1(0),000 challenge

Background This challenge is about A004001, a.k.a. Hofstadter-Conway $10000 sequence: $$ a_1 = a_2 = 1, \quad a_n = a_{a_{n-1}} + a_{n-a_{n-1}} $$ which starts with ...
Bubbler's user avatar
  • 76k
11 votes
2 answers
438 views

Spanning paths in a tournament on n nodes

The goal of this challenge is to extend the On-Line Encyclopedia of Integer Sequences (OEIS) sequence A038375. Maximal number of spanning paths in tournament on n nodes. A tournament on \$n\$ ...
Peter Kagey's user avatar
  • 8,679
13 votes
9 answers
438 views

Minimal Rotate-Right-Double numbers in base n

Task For a given base \$n \ge 3\$, find the smallest positive integer \$m\$, when written in base \$n\$ and rotated right once, equals \$2m\$. The base-\$n\$ representation of \$m\$ cannot have ...
Bubbler's user avatar
  • 76k
15 votes
14 answers
1k views

Generating generating expressions for sequences

(yes, "generating generating" in the title is correct :) ) Context In middle (?) school we are taught about sequences and, in particular, we are taught about linear sequences where the ...
RGS's user avatar
  • 14.1k

1
3 4
5
6 7
19