Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
11 votes
4 answers
1k views

Output a 1-2-3-5-7... sequence

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
  • 1,805
19 votes
15 answers
2k views
+200

Output a 1-2-3 sequence

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
  • 1,805
13 votes
12 answers
2k views

Odds for second smallest prime factor

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
  • 10.6k
2 votes
3 answers
188 views

Rank poker High Card hands [closed]

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

How quickly can you type this unary string?

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
  • 37.8k
15 votes
16 answers
1k views

Pretty Palintiples

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
  • 487
10 votes
13 answers
1k views

Enumerate the Phat-fingered-lights-out numbers

Even though the concept of phat-fingered-lights-out number should be pretty self-explanatory here is a definition: Given a nonnegative integer in binary representation a phat-fingered double-bit-flip ...
loopy walt's user avatar
  • 16.7k
1 vote
8 answers
288 views

Alternating Random Series Sum To \$N\$ [closed]

Challenge Given a positive integer \$N \ge 3\$, generate an alternating series of \$N\$ random numbers within the range \$[1, N]\$, such that their sum equals \$N\$. Expressed mathematically as $$N = ...
vengy's user avatar
  • 2,163
5 votes
5 answers
648 views

Double-reduce a sequence of integers

Consider a function \$r\$ where $$ r(i,k)= \begin{cases} L_{i+1}-L_i, & \text{if}\ k =0\ \text{ (1st reduction)} \\ r(i,0)-r(\lfloor \log_2{k} \rfloor,k-2^{\lfloor \log_2{k} \rfloor}) & \text{...
enzo's user avatar
  • 2,083
13 votes
14 answers
605 views

Binary Expansion Counting Sequence

I found another sequence not yet in the OEIS The binary expansion sequence is defines as follows, assuming 0 indexing: The even numbers of the sequence are how often 0 has appeared in the binary ...
mousetail's user avatar
  • 12.5k
19 votes
21 answers
2k views

Mousetail's Sequence

I define mousetail's sequence as follows: If the nth element of the sequence is q, then n+1 must appear q times in the sequence The sequence is weakly monotonically increasing (i.e. no lower number ...
mousetail's user avatar
  • 12.5k
1 vote
0 answers
147 views

Exact Sum of 1/2 to 1/n [duplicate]

Consider the sequence 1/2, 1/3 + 1/2, 1/4 + 1/3 + 1/2, and so on. In mathematical symbols, this is $$S(n)=\sum_{m=2}^{n+1}\frac{1}{m}$$ where S is the function that makes the sequence. Outputting this ...
Jakav's user avatar
  • 335
9 votes
12 answers
1k views

How many Carlitz compositions are there?

OEIS sequence A003242 comprises the numbers of Carlitz compositions for any given positive integer. This is the number of integer partitions of the integer for which no two adjacent parts are equal. ...
Nick Kennedy's user avatar
  • 21.1k
19 votes
9 answers
977 views

Output an infinitely proportional sequence

In this challenge, an infinitely proportional sequence is defined as a infinite sequence of positive integers such that: All positive integers are contained infinitely many times within the sequence. ...
emanresu A's user avatar
  • 37.8k
18 votes
24 answers
2k views

Test whether a sequence is bitonic

You know what a monotonic sequence is: each element is bigger than its predecessor (monotonically rising) or as its successor (monotonically falling). Bitonic means you have two arms of the sequence, ...
Philippos's user avatar
  • 2,501
14 votes
1 answer
262 views

Construct the Constructability sequence

Consider compass-and-straightedge construction, where you can construct new points from existing ones by examining intersections of straight lines and circles constructed with one of the following two ...
caird coinheringaahin g's user avatar
18 votes
39 answers
2k views

Rudin-Shapiro sequence

The Rudin-Shapiro sequence is a sequence of \$1\$s and \$-1\$s defined as follows: \$r_n = (-1)^{u_n}\$, where \$u_n\$ is the number of occurrences of (possibly overlapping) \$11\$ in the binary ...
alephalpha's user avatar
17 votes
23 answers
2k views

Monotone sequence beatitude

Provided that the input is a monotone sequence of three or more integers: Output -2 if the sequence strictly decreases. Example: [7,4,3,2] Output -1 if the ...
Dannyu NDos's user avatar
  • 5,941
5 votes
9 answers
4k views

Minecraft XP Orb Amounts

In the video game Minecraft, the player can obtain experience points (XP) from various activities. In the game, these are provided as XP "orbs" of various sizes, each of which give the ...
97.100.97.109's user avatar
16 votes
18 answers
2k views

Divisor chain counts (1 3 3 7 ...)

The divisors of a natural number form a poset under the relation of "a divides b?", \$a | b\$. This challenge is to produce the number, \$C\$, of non-empty chains of such posets for natural ...
Jonathan Allan's user avatar
20 votes
23 answers
2k views

Diagonal Binary Sequence

Challenge: Given a positive number \$n\$, convert it to binary, and output a sequence where all 1s form a top-left to bottom-right diagonal line, including a ...
Kevin Cruijssen's user avatar
9 votes
9 answers
2k views

Make a super fair number

An even distribution number is a number such that if you select any of it's digits at random the probability of it being any particular value (e.g. 0 or ...
Wheat Wizard's user avatar
  • 98.5k
15 votes
14 answers
1k views

The multiples are missing

Given a number \$n\$, you are to compute the sequence of positive numbers where for each number \$a\$, the \$n\$-times multiple \$n\cdot a\$ is missing. Example We always start with the sequence of ...
Laikoni's user avatar
  • 26.2k
18 votes
20 answers
2k views

Complement an infinite list

In this challenge, we define the complement of a list of positive integers as all positive integers not included in that list. For example, the complement of the even numbers ...
emanresu A's user avatar
  • 37.8k
10 votes
7 answers
754 views

Longest sequence of Egyptian fractions with n as denominator

Background From Wikipedia: An Egyptian fraction is the sum of distinct unit fractions. That is, each fraction in the expression has a numerator equal to 1 and a denominator that is a positive integer, ...
Anm's user avatar
  • 203
16 votes
10 answers
1k views

Find the longest permutations of integers from 1..k such that all neighbouring pairs sum to a square

OEIS A090461 details the ‘numbers k for which there exists a permutation of the numbers 1 to k such that the sum of adjacent numbers is a square’. This has also been the subject of Matt Parker’s ...
Nick Kennedy's user avatar
  • 21.1k
10 votes
16 answers
1k views

Numbers with distinct decimal digits

Write a program or function that outputs all positive integers with distinct decimal digits (OEIS: A010784) Examples: ...
bsoelch's user avatar
  • 6,015
14 votes
18 answers
2k views

Golf the fast growing hierarchy

The fast growing hierarchy is a way of categorizing how fast functions are growing, defined the following way (for finite indices): \$ f_0(n)=n+1 \$ \$ f_k(n)=f_{k-1}^n(n)\$ with \$f^n\$ meaning ...
bsoelch's user avatar
  • 6,015
1 vote
0 answers
61 views

How Many Staircases [duplicate]

Problem You're a staircase engineer on a house and realize you only have n rectangles to create a staircase. So you are tasked with finding the number of ways to ...
3.14's user avatar
  • 383
9 votes
11 answers
741 views

Otteretto Classic game scoring method

Brief description of the game In the game Otteretto Classic (which you can test directly in your browser; try it!) the player has to form palindromic sequences using adjacent cells on a square grid. ...
Luis Mendo's user avatar
  • 104k
8 votes
19 answers
1k views

Piecing Paired Primes

Problem You've stumbled upon a paradoxical mathematical phenomenon related to prime numbers. Consider the following scenario: You have an infinite list of prime numbers: $$2, 3, 5, 7, 11, 13, 17, 19, ....
3.14's user avatar
  • 383
13 votes
9 answers
3k views

Give the fool's Fibonacci sequence

Recently I asked for tips on improving some code-golf of mine. The code was supposed to output every third value of the Fibonacci sequence starting with 2: ...
Wheat Wizard's user avatar
  • 98.5k
10 votes
12 answers
2k views

Encrypting Emojis

Problem You are tasked with creating a program that performs emoji encryption on a given string of emojis. In this encryption scheme, each emoji is replaced by a unique character (from ...
3.14's user avatar
  • 383
15 votes
16 answers
839 views

Output the smallest increasing sequence where each term is coprime to preceding 3 terms

This sequence is defined as Starts with 1, 2, 3 The next element of the sequence is the first number greater than the previous three that is co-prime with each of the previous 3 elements in the ...
mousetail's user avatar
  • 12.5k
8 votes
8 answers
645 views

Magic OEIS formulae (Robbers' thread)

This is the robbers' thread. See the cops' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the ...
dingledooper's user avatar
  • 22.7k
12 votes
9 answers
756 views

Magic OEIS formulae (Cops' thread)

This is the cops' thread. See the robbers' thread here. In this cops and robbers challenge, the cops will be tasked with writing an algorithm that computes some function of their choice, while the ...
dingledooper's user avatar
  • 22.7k
11 votes
12 answers
1k views

The all-high powerful numbers

We've had powerful numbers, yes, but what about highly powerful numbers? Highly powerful numbers Let \$n\$ be a positive integer in the form $$n = p_1^{e_{p_1}(n)}p_2^{e_{p_2}(n)}\cdots p_k^{e_{p_k}(n)...
caird coinheringaahin g's user avatar
20 votes
5 answers
1k views

Repeating occupied pattern in Hilbert's hotel

Imagine a countable infinite amount of empty rooms. When an infinite amount of guests come, they occupy the 1st, 3rd, 5th...(all odd) empty rooms. Therefore there's always an infinite amount of empty ...
l4m2's user avatar
  • 23.9k
32 votes
36 answers
2k views

Make a k-skip-j range

On the Mathematica Stack Exchange, 100xln2 asks: I need a list of integers […] The list contains integers and is characterized by [three] parameters, lets call them k and j [and listmax], which ...
Lynn's user avatar
  • 68.7k
14 votes
14 answers
2k views

Print all Polynomials

The set of all polynomials with integer coefficients is countable. This means that there is a sequence that contains each polynomial with integer coefficients exactly once. Your goal is it to write a ...
bsoelch's user avatar
  • 6,015
19 votes
10 answers
3k views

Numbers that can be negated by reading backwards

Balanced ternary is a modified version of ternary (base 3), using the three digits 1,0 and -1...
bsoelch's user avatar
  • 6,015
24 votes
41 answers
3k views

Sum of a range of a sum of a range of a sum of a range of a sum of a range of a sum of

Inspired by the fact that a few related challenges to this could be answered by Vyxal in 0 Bytes using a special flag combination. Given only one input integer \$n\$, calculate \$f(n,n)\$ where $$ f(x,...
The Empty String Photographer's user avatar
11 votes
6 answers
706 views

Compute the maximal Ducci period

Given an initial \$n\$-tuple \$t_0=(t_{0,1},...,t_{0,n})\$, we can obtain its corresponding Ducci sequence \$\{t_0, t_1, ...\}\$ by the recurrence \$\displaystyle t_{i+1}=\left(\left|t_{i,1}-t_{i,2}\...
att's user avatar
  • 20.4k
13 votes
8 answers
710 views

Generate all linked chains

A followup to this challenge by Jeremy Collprav, inspired by DLosc solving this in Regenerate. Some sections copied from the linked challenge. Linking chains We define a chain to be a string ...
caird coinheringaahin g's user avatar
47 votes
39 answers
3k views

Last odd digit of power of 2

Task Given \$n\$, output position of the last odd digit in the decimal representation of \$2^n\$ (counting from the end). Rules There are no odd digits for \$n=1,2,3,6,11\$ \$(2, 4, 8, 64, 2048)\$ - ...
pajonk's user avatar
  • 15.9k
23 votes
28 answers
2k views

Lowest digit addition generator

A digit addition generator of an integer n is any integer x that satisfy the equation ...
Tom Epsilon's user avatar
21 votes
7 answers
1k views

How many sorting networks?

Below on the left is a picture of a sorting network that can sort 4 inputs. On the right you can see it sorting the input 3,2,4,1. A sorting network of size ...
AnttiP's user avatar
  • 7,878
-3 votes
7 answers
1k views

Straight pen strokes for Prime Numbers

Challenge You are supposed to output the series I recently designed which goes as follows which are pen stroke counts of ascending prime numbers: ...
Aitzaz Imtiaz's user avatar
15 votes
13 answers
1k views

Hankel transform of an integer sequence

A Hankel matrix is a square matrix in which each ascending skew-diagonal from left to right is constant, e.g.: $$\begin{bmatrix} a & b & c & d \\ b & c & d & e \\ c & d &...
alephalpha's user avatar
12 votes
15 answers
1k views

The number of solutions to Hertzsprung's Problem

Hertzprung's Problem (OEIS A002464) is the number of solutions to a variant of the Eight Queens Puzzle, where instead of placing \$n\$ queens, you place \$n\$ rook-king fairy pieces (can attack like ...
bigyihsuan's user avatar
  • 9,348

1
2 3 4 5
19