Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [sequence]

For challenges involving some sort of sequence.

15
votes
11answers
678 views

New Order #2: Turn My Way

Introduction (may be ignored) Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all ...
11
votes
9answers
434 views

New Order #1: How does this feel?

Introduction Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. ...
12
votes
9answers
747 views

Source permutation

A permutation of a set \$S = \{s_1, s_2, \dotsc, s_n\}\$ is a bijective function \$\pi: S \to S\$. For example, if \$S = \{1,2,3,4\}\$ then the function \$\pi: x \mapsto 1 + (x + 1 \mod 4)\$ is a ...
25
votes
28answers
3k views

Make me a metasequence

Background For this challenge, a 'metasequence' will be defined as a sequence of numbers where not only the numbers themselves will increase, but also the increment, and the increment will increase ...
12
votes
18answers
899 views

Jumping Numbers

A jumping number is defined as a positive number n which all pairs of consecutive decimal digits differ by 1. Also, all single digit numbers are considered jumping numbers. eg. 3, 45676, 212 are ...
9
votes
10answers
394 views

Generate a Baseball Pitch String

Goal Write a program or function that takes a positive integer n and randomly generate a legal series of pitches (a Pitch string) of length ...
19
votes
25answers
2k views

The Highest Dice

Challenge: Here we have the first 100 items of a sequence: ...
26
votes
13answers
2k views

Superpermutations

Introduction You're a criminal tasked with stealing some secret plans from the new tech startup Dejavu. You sneak in over the back wall, but find a door that requires a pin to open it. You recognize ...
23
votes
3answers
1k views

The Path Of The Wildebeest

Golf a program or function which gives the \$n^{\text{th}}\$ location of the wildebeest who starts at square \$1\$ on an infinite chessboard which is numbered in an anti-clockwise square spiral, where ...
15
votes
4answers
657 views

Number of \$n\$-carbon alkanes

Given a positive number \$n\$, find the number of alkanes with \$n\$ carbon atoms, ignoring stereoisomers; or equivalently, the number of unlabeled trees with \$n\$ nodes, such that every node has ...
16
votes
23answers
2k views

Find if a list is an ABC-triple

Three positive integers A, B, C are ABC-triple if they are coprime, with A < B and satisfying the relation : A + B = C Examples : 1, 8, 9 is an ABC-triple ...
23
votes
18answers
2k views

Collapsing numbers

Let's define the a function on natural numbers \$n\$, written as base 10 digits \$d_k\; d_{k-1}\; \dotsc\; d_1\; d_0\$, as follows: As long as there are equal adjacent digits \$d_i\;d_{i-1}\$, ...
21
votes
2answers
486 views

A spiral sequence

Background OEIS sequence A272573 describes a spiral on a hexagonal grid as follows: Start a spiral of numbers on a hexagonal tiling, with the initial hexagon as a(1) = 1. a(n) is the smallest ...
25
votes
46answers
4k views

Draw some expanding arrows

This challenge is about printing a series of growing ASCII-art arrows. I'll describe the pattern in words, but it might be easier to look at what the start of this series looks like: ...
21
votes
26answers
2k views

Digital Sumorial

Given an input n, write a program or function that outputs/returns the sum of the digital sums of n for all the bases 1 to ...
13
votes
20answers
1k views

Number in Number-squared

Consider a sequence of natural numbers for which N appears as a substring in N^2. A018834 Output the nth element of this sequence. Rules Program takes only ...
32
votes
44answers
4k views

Print all lexicographically increasing numbers under 10000

A lexicographically increasing number is an integer whose digits are in strictly increasing order. Print all lexicographically increasing numbers under 10000. Here are lines of the expected output: ...
13
votes
11answers
1k views

Terms of the EKG sequence

Introduction The EKG sequence begins with 1 and 2, then the rule is that the next term is the smallest positive integer not already in the sequence and whose common factor with the last term is ...
9
votes
5answers
199 views

Find the minimal initial values [duplicate]

Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The ...
20
votes
22answers
1k views

New Neighbour Sequence

The non-negative integers are bored of always having the same two* neighbours, so they decide to mix things up a little. However, they are also lazy and want to stay as close as possible to their ...
17
votes
19answers
2k views

The Written Digits Sequence

Here's a reasonably trivial sequence which is not in the Online Encyclopedia of Integer Sequences. Start with an empty sequence then define each term as the number of characters required to write out,...
21
votes
23answers
2k views

Minimal Power Root

The minimal power iteration of a number \$n\$ is defined as follows: $$\text{MPI}(n):=n^{\text{min}(\text{digits}(n))}$$ That is, \$n\$ raised to the lowest digit in \$n\$. For example, \$\text{MPI}(...
20
votes
64answers
5k views

Display numbers lacking 2's

Display numbers from one to one-hundred (in increasing order), but number 2 shouldn’t appear anywhere in the sequence. So, for example, the numbers two (2) or ...
16
votes
21answers
2k views

How many threes?

In this task your code will be given an integer \$n\$ as input. Your code should then output the greatest number of multiples of \$3\$ that can be concatenated (in base \$10\$) to form \$3n\$ (with ...
13
votes
10answers
1k views

Quadratic residues are so much fun!

Definitions Quadratic residues An integer \$r\$ is called a quadratic residue modulo \$n\$ if there exists an integer \$x\$ such that: $$x^2\equiv r \pmod n$$ The set of quadratic residues modulo \...
12
votes
2answers
274 views

Removing points from a triangular array without losing triangles

I have a combinatorics problem that I'd like to put on the OEIS—the problem is that I don't have enough terms. This code challenge is to help me compute more terms, and the winner will be the user ...
4
votes
3answers
186 views

Hyperoperation Golfing [duplicate]

Introduction In mathematics, the hyperoperation sequence is an infinite sequence of arithmetic operations (called hyperoperations) that starts with the unary operation of successor (n = 0), then ...
31
votes
41answers
5k views

Half, Half Half, and, Half

Consider the following number sequence: \$ 0, \frac{1}{2}, \frac{1}{4}, \frac{3}{4}, \frac{1}{8}, \frac{3}{8}, \frac{5}{8}, \frac{7}{8}, \frac{1}{16}, \frac{3}{16}, \frac{5}{16}, \frac{7}{16}, \...
3
votes
1answer
153 views

Sorting out redundant text from screen scraper application [closed]

You are writing a screen scraper application monitoring a text-only chat window. Text is added at the bottom of the window. The application takes screenshot of the chat window. If a change has ...
6
votes
20answers
421 views

Find the \$\left(n^2\right)^\text{th }n\$-gonal number

Given a non-negative integer, \$n\$, yield the \$(n^2)^\text{th } n\$-gonal number. Further Detail: The \$x\$-gonal numbers, or polygonal numbers, are also known as the two-dimensional figurate ...
7
votes
0answers
97 views

How long to cross the bridge? [duplicate]

Introduction There is a group of people that have to cross a rickety bridge that can only support two people at a time. It is a dark and foggy night, but unfortunately, the group only has one lamp. ...
12
votes
17answers
500 views

Compute the minimum \$a(n)>a(n-1)\$ such that \$a(1)+a(2)+\dots+a(n)\$ is prime (OEIS A051935)

Background Consider the following sequence (A051935 in OEIS): Start with the term \$2\$. Find the lowest integer \$n\$ greater than \$2\$ such that \$2+n\$ is prime. Find the lowest integer \$n'\$ ...
17
votes
22answers
2k views

Sort by what the digit pairs describe

Given a positive integer, we can form a new number that's described by its digits taken pairwise (with a leading 0 added for numbers with odd number of digits). For eg.: 1234 can be read as one 2, ...
10
votes
26answers
1k views

A function to take three integers and return a list of integers and alphabet-letters

Challenge We take three positive integers a, b, and c as input. Using these integers, first ...
11
votes
4answers
318 views

Ex-Increasing Set Sequence

Background An ex-increasing set sequence of order \$N\$ is defined as a sequence of integer sets \$S_1,S_2,\cdots,S_n\$ which satisfies the following: Each \$S_i\$ is a non-empty subset of \$\{1,2,\...
12
votes
7answers
734 views
11
votes
2answers
362 views

A Lazy Bag of Bread

I work at a bakery that serves Wheat, Rye, Barley, Grain, and French bread, but the baker's a little weird - he stacks the loaves in random order, and sometimes just leaves some shelves at the end ...
18
votes
12answers
2k views

In for a bumpy ride

Your task is to write a computer program or function that takes a list of positive integers of at least length 2 and determines if they are a "zigzag". A sequence is a zigzag if and only if the ...
44
votes
97answers
6k views

Concatenating n with n + 1

Introduction OEIS sequence A127421 is the sequence of numbers whose decimal expansion is a concatenation of 2 consecutive increasing non-negative numbers. Put simply, every number in the sequence is ...
12
votes
14answers
1k views

Hardcoding the Cops and Robbers (Robbers)

This is a cops-and-robbers challenge. The Cops' thread to this challenge is here An interesting question to think about is the following: If I have a sequence of numbers how many of them do I have ...
28
votes
18answers
2k views

Hardcoding the Cops and Robbers (Cops)

This is a cops-and-robbers challenge. The robbers' thread is here. An interesting question to think about is the following: If I have a sequence of numbers how many of them do I have to provide ...
31
votes
54answers
4k views

Consecutive 1-Bits are Incremented

Given a pattern (string or array format) of Bits : [0,1,1,1,0,1,1,0,0,0,1,1,1,1,1,1] The tasks is to replace any number of consecutive 1-Bits with an ascending ...
14
votes
6answers
678 views

Recamán's duplicates

Recamán's Sequence is defined as follows: \$a_n=\begin{cases}0\quad\quad\quad\quad\text{if n = 0}\\a_{n-1}-n\quad\text{if }a_{n-1}-n>0\text{ and is not already in the sequence,}\\a_{n-1}+n\quad\...
27
votes
4answers
739 views

Smallest region of the plane that contains all free n-ominoes

On Math Stack Exchange, I asked a question about the smallest region that can contain all free n-ominos. I'd like to add this sequence to the On-Line Encyclopedia of Integer Sequences once I have ...
19
votes
18answers
2k views

The Jumping Up Sequence

Consider the following sequence: 0 1 3 2 5 4 8 6 7 12 9 10 11 17 13 14 15 16 23 ... Looks pretty pattern-less, right? Here's how it works. Starting with ...
24
votes
17answers
2k views

Integers sorted by their digital roots

The digital root (also repeated digital sum) of a positive integer is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous ...
19
votes
15answers
2k views

Upper or Lower Wythoff?

First, let's talk about Beatty sequences. Given a positive irrational number r, we can construct an infinite sequence by multiplying the positive integers to r in order and taking the floor of each ...
4
votes
1answer
321 views

Pair and sort from two integer lists

You are given two arbitrary integer lists, e.g. [-10, 99, -6, 43], [100, 32, 44]. You are to pick one integer from each list and ...
8
votes
6answers
246 views

Golfing Chain (Robbers' Thread)

This is a Cops and Robbers challenge. For the Cops' thread, go here. The Cops have three tasks. 1) Pick a sequence from the OEIS. 2) Pick a language (this is suggested to be a golflang, but doesn'...
13
votes
6answers
342 views

Golfing Chain (Cops' Thread)

This is a Cops and Robbers challenge. For the Robbers' thread, go here. The Cops have three tasks. 1) Pick a sequence from the OEIS. 2) Pick a language (this is suggested to be a golflang, but ...