Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
5 votes
19 answers
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 ...
Number Basher's user avatar
12 votes
17 answers
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 ...
Matthew Jensen's user avatar
22 votes
9 answers
995 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 ...
ATO's user avatar
  • 430
15 votes
24 answers
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 ...
LWS SWL's user avatar
  • 420
19 votes
17 answers
3k views

Join my exclusive friendly club!

Two or more positive integers are said to be "friendly" if they have the same "abundancy". The abundancy of an positive integer \$n\$ is defined as $$\frac {\sigma(n)} n,$$ where \$...
caird coinheringaahin g's user avatar
22 votes
12 answers
2k views

How many Sieve of Eratosthenes hits?

Sieve of Eratosthenes is a method for finding prime numbers: take the sequence of all positive integer numbers starting from 2 then for each remaining number drop all its multiples. ...
AZTECCO's user avatar
  • 10.8k
10 votes
7 answers
365 views

Maximum population of a \$n \times n\$ still life in Conway's Game of Life

This is OEIS sequence A055397. In Conway's Game of life, a still life is a pattern that does not change over time. We can see from the rules of Conway's Game of life that, a pattern is a still life if ...
alephalpha's user avatar
10 votes
13 answers
1k views

Smallest numbers whose square has even number of digits

...
AZTECCO's user avatar
  • 10.8k
18 votes
16 answers
1k views

Long period primes

A long period prime is a prime number \$p\$ such that decimal expansion of \$1/p\$ has period of length \$(p-1)\$. Your task is to output this number sequence. For purposes of this challenge we will ...
pajonk's user avatar
  • 16k
22 votes
17 answers
1k views

Pairs of integers ordered by their exponentiation

Output the infinite list of pairs of integers (a, b), where both \$ a > 1 \$ and \$ b > 1 \$, ordered by the value of \$ a^b \$. When there are multiple pairs ...
pxeger's user avatar
  • 23.7k
32 votes
21 answers
3k views

How-many-bonacci-like is this sequence?

Inspired by @emanresu A's Is it a fibonacci-like sequence? Make sure to upvote that challenge as well! We say a sequence is Fibonacci-like, if, starting from the third term (\$1\$-indexed), each term ...
alephalpha's user avatar
19 votes
33 answers
1k views

Sum of the first n elements of the sequence of 9's complement

Let's consider the following sequence: $$9,8,7,6,5,4,3,2,1,0,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71...$$ This is the sequence of \$9\$'s complement of a number: that is, \$ a(x) = 10^...
sinvec's user avatar
  • 1,943
14 votes
15 answers
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 ...
Jonathan Allan's user avatar
12 votes
8 answers
840 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 ...
AnttiP's user avatar
  • 7,878
16 votes
4 answers
601 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 ...
Wheat Wizard's user avatar
  • 98.7k
16 votes
13 answers
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, ...
caird coinheringaahin g's user avatar
21 votes
13 answers
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 ...
Wheat Wizard's user avatar
  • 98.7k
9 votes
1 answer
358 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, ...
atzlt's user avatar
  • 487
7 votes
10 answers
799 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: ...
Fmbalbuena's user avatar
  • 3,847
18 votes
16 answers
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 ...
Wheat Wizard's user avatar
  • 98.7k
-6 votes
4 answers
156 views

Indices of square numbers that are also pentagonal [closed]

First 15 numbers of the A046173: ...
DialFrost's user avatar
  • 5,079
16 votes
6 answers
760 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 ...
Wheat Wizard's user avatar
  • 98.7k
24 votes
32 answers
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 ...
DialFrost's user avatar
  • 5,079
16 votes
13 answers
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 ...
pxeger's user avatar
  • 23.7k
20 votes
3 answers
992 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-...
Bubbler's user avatar
  • 76.1k
30 votes
20 answers
2k views

An ASCII self-referential sequence

The sequence A109648 starts with the following numbers ...
Bubbler's user avatar
  • 76.1k
12 votes
7 answers
296 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\$. ...
caird coinheringaahin g's user avatar
14 votes
4 answers
602 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 ...
AnttiP's user avatar
  • 7,878
29 votes
13 answers
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 ...
Larry Bagel's user avatar
  • 4,173
12 votes
9 answers
604 views

AoCG2021 Day 17: Langton's Hexa-Virus

The story continues from AoC2017 Day 22, Part 2. The damn virus that was infecting a grid computing cluster now has jumped to a hexagonal computing cluster! In this cluster, the computers are ...
Bubbler's user avatar
  • 76.1k
32 votes
30 answers
2k views

Converge to a number

Your challenge is to, given a positive integer n, count up to each digit of it, giving the effect of converging on it. Basically, count up to the first digit of n by its place value (\$⌊\log_{10}\left(...
emanresu A's user avatar
  • 37.9k
14 votes
15 answers
1k views

Fully matched numbers

For the context of this challenge, a matched group is a digit \$n\$, followed by \$n\$ more matched groups. In the case of \$n = 0\$, that's the whole matched group. Digits only go up to 9. For ...
emanresu A's user avatar
  • 37.9k
28 votes
10 answers
2k views

Sum powers to n

Each natural number (including 0) can be written as a sum of distinct powers of integers (with a minimum exponent of 2). Your task is to output the smallest power required to represent \$n\$. For ...
Spitemaster's user avatar
  • 2,135
18 votes
23 answers
1k views

AoCG2021 Day 3: Say-Look-Say

Part of Advent of Code Golf 2021 event. See the linked meta post for details. Related to AoC2015 Day 10. Here's why I'm posting and not Bubbler The Elves are playing a variation of the game called ...
lyxal's user avatar
  • 33.3k
14 votes
9 answers
2k views

All distances different on a chessboard

Inspired by this Puzzling SE question: All distances different on a chess board. Introduction Lets define a sequence \$a(n), n\geqslant 1\$ as how many pawns can you put on a \$n \times n\$ chessboard ...
pajonk's user avatar
  • 16k
17 votes
13 answers
4k views

Worst case of Slowsort

Background Slowsort is an in-place, stable sorting algorithm that has worse-than-polynomial time complexity. The pseudocode for Slowsort looks like this: ...
Bubbler's user avatar
  • 76.1k
16 votes
21 answers
2k views

Harmonic divisor numbers

Consider the \$4\$ divisors of \$6\$: \$1, 2, 3, 6\$. We can calculate the harmonic mean of these numbers as $$\frac 4 {\frac 1 1 + \frac 1 2 + \frac 1 3 + \frac 1 6} = \frac 4 {\frac {12} 6} = \frac ...
caird coinheringaahin g's user avatar
1 vote
2 answers
109 views

When the result will reach the people? [closed]

Assume the result of an exam has been published. After 5 minutes, First person knows the result. In next 5 minutes, new 8 persons know the result, and in total 9 know it. Again after 5 minutes, new 27 ...
Camel's user avatar
  • 169
10 votes
1 answer
314 views

Concatenation Coincidence

This code-golf challenge (and test cases) are inspired by the work of Project Euler users amagri, Cees.Duivenvoorde, and oozk, and Project Euler Problem 751. (And no, this isn't on OEIS). Sandbox A ...
Rushabh Mehta's user avatar
17 votes
11 answers
2k views

Binary triangle A141727

Challenge Generate the 2D sequence of bits of A141727. (Allowed I/O methods explained at the bottom.) ...
Bubbler's user avatar
  • 76.1k
15 votes
14 answers
2k views

Inverse n-bonacci sequence

We all know about the Fibonacci sequence. We start with two 1s and keep getting the next element with the sum of previous two elements. n-bonacci sequence can be defined in similar way, we start with <...
Camel's user avatar
  • 169
16 votes
15 answers
2k views

Print Gobar Primes

Gobar primes (A347476) are numbers which give a prime number when 0's and 1's are interchanged in their binary representation. For example, \$10 = 1010_2\$, and if we flip the bits, we get \$0101_2 = ...
Ha'Penny's user avatar
  • 193
21 votes
9 answers
1k views

Self-referential triangle sequence

Output the flattened version of the sequence A297359, which starts like the following: ...
Bubbler's user avatar
  • 76.1k
13 votes
8 answers
1k views

Find the number of paths in a n×n grid

Information Given a non-negative odd integer (let's call it \$n\$), find the number of all possible paths which covers all squares and get from the start to end on a grid. The grid is of size \$n\$×\$...
zoomlogo's user avatar
  • 1,655
15 votes
7 answers
3k views

Make S + S + ... + S as Large as Possible!

Let \$S \subset \mathbb N_{\geq0}\$ be a subset of the nonnegative integers, and let $$ S^{(k)} = \underbrace{S + S + \dots + S}_{k\ \textrm{times}} = \{ a_1 + a_2 + \dots + a_k : a_i \in S\}. $$ For ...
Peter Kagey's user avatar
  • 8,679
17 votes
9 answers
961 views

Maybe fractal sequence?

Background A fractal sequence (Wikipedia; MathWorld) is an infinite sequence of positive integers meeting the following conditions: Each positive integer appears infinitely many times in the sequence....
Bubbler's user avatar
  • 76.1k
27 votes
32 answers
2k views

Triple countdown sequence

Let's start with the natural numbers ...
Wheat Wizard's user avatar
  • 98.7k
24 votes
12 answers
2k views

Greedy queens sequence

Challenge Implement the "greedy queens" sequence (OEIS: A065188). Details Taken from the OEIS page. This permutation [of natural numbers] is produced by a simple greedy algorithm: starting ...
pajonk's user avatar
  • 16k
15 votes
5 answers
940 views

Non-sums of distinct positive powers

There are 31 positive integers that cannot be expressed as the sum of 1 or more distinct positive squares: ...
caird coinheringaahin g's user avatar
19 votes
15 answers
2k views

Euler's numerus idoneus

Euler's numerus idoneus, or idoneal numbers, are a finite set of numbers whose exact number is unknown, as it depends on whether or not the Generalized Riemann hypothesis holds or not. If it does, ...
caird coinheringaahin g's user avatar

1 2
3
4 5
19