# Questions tagged [sequence]

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

934 questions
Filter by
Sorted by
Tagged with
300 views

### Shortest code to generate 2D coordinates

I'm looking for the shortest code to generate the following sequences: Sequence A i | y x 0 | 0 0 1 | 0 1 2 | 1 0 3 | 1 1 The best I have is ...
• 123
2k views

### Calculate practical numbers

Definition A positive integer n is a practical number (OEIS sequence A005153) iff all smaller positive integers can be represented as sums of distinct divisors of <...
• 43.1k
27k views

### 4, 8, 15, 16, 23, 42 [closed]

4, 8, 15, 16, 23, 42 Write a program that outputs this sequence of numbers infinitely. However, The Numbers must not appear in your source code anywhere. The following is not a valid Java program to ...
• 2,416
1k views

### Point-free look and say sequence [duplicate]

You are too make a program that take an integer as the input and outputs the first what ever that number was of the look and say sequence. For example: ...
• 7,235
767 views

### Find all Perrin pseudoprimes less than 100 million

Simply put, the Perrin sequence has the following recurrence relation: P(n) = P(n-2) + P(n-3); P(0) = 3; P(1) = 0; P(2) = 2; But wait!! There's more!! The Perrin sequence has a very bizarre property:...
• 29.1k
4k views

### Write a program which performs brute force letter combination until the word "password" is found

The program should print every letter combination (lowercase or uppercase, it doesn't matter) in alphabetic order. It must start with a and the last printed ...
• 1,369
13k views

### Collatz Conjecture (OEIS A006577)

This is the Collatz Conjecture (OEIS A006577): Start with an integer n > 1. Repeat the following steps: If n is even, divide it by 2. If n is odd, multiply it by 3 and add 1. It is proven that ...
• 71.5k
4k views

### Flipping pancakes

In pancake sorting the only allowed operation is to reverse the elements of some prefix of the sequence. Or, think of a stack of pancakes: We insert a spatula somewhere in the stack and flip all the ...
• 18.6k
1k views

### Generate Skolem sequences

Skolem sequences A Skolem sequence is a sequence of 2n numbers where every number i between ...
• 9,786
1k views

### The number of possible numeric outcomes of parenthesizations of 2^2^...^2

Consider an expression 2^2^...^2 with n operators ^. Operator ...
• 2,523
9k views

### Give the smallest number that has N divisors

Your function takes a natural number and returns the smallest natural number that has exactly that amount of divisors, including itself. Examples: ...
• 2,463
652 views

### Make a pattern alternate

Problem You are given a sequence of coloured balls (red R and green G). One such possible sequence is: ...
• 3,348
4k views

### Longest non-repeating Game-of-Life sequence

Given a positive integer N, determine the starting pattern on a N x N-grid that yield the longest non-repeating sequence under Game of Life-rules, and ends with a fixed pattern (cycle of length 1), ...
357 views

### Determine the original sequence

Write a program that will determine the original sequence given five variations. The original sequence will be contain n unique elements in any order. A variation is made by making a copy of the ...
• 16.9k
1k views

### Return each number from a group of numbers

The challenge The program must return all numbers included into a group (comma and hyphen separated sequence) of numbers. Rules s is the sequence string; all ...
• 345
4k views

### Quickly find length of n-th term of the look-and-say sequence

The look and say sequence is an example of a run length encoding sequence. To get the next term of the sequence one groups the sequence into runs of the same number, each group in the next term then ...
• 1,649
6k views

### Calculate the nth term of Golomb's self-describing sequence

Inspired by the previous question. Golomb's self-describing sequence g(n) is a sequence where any natural number n is repeated within the sequence g(n) times. The ...
• 4,350
5k views

### Generate a Kolakoski sequence [duplicate]

Definition1 A Kolakoski sequence is a self-describing infinite sequence {kn} of alternating blocks of 1's and 2's, given by the following rules: k0 = 1 kn = the length of the (n+1)'th ...
• 2,329
661 views

### Generate a valid sequence of numbers with specific rules [closed]

The challenge The program must return a valid sequence of numbers into some rules Rules x is the size of the sequence; x ...
• 345
1k views

### Universal (rule-bending) Code Golf solver

Code golf always involves some answers that bend the rules more or less by breaking constraints that the challengers took for granted or just haven't thought about and didn't list in the rules. One of ...
• 1,202
2k views

### Arithmetic Sequences

An arithmetic sequence is a sequence of numbers of the form a,a+n,a+2n,...
• 4,350
3k views

### Josephus problem (counting out)

The challenge Write a function that takes two positive integers $n$ and $k$ as arguments and returns the number of the last person remaining out of $n$ after counting out each $k$-th person. ...
• 23.5k
895 views

### Generate the list [1, 0, -1, 0, 1, 0, -1, 0, ...] [closed]

In the spirit of a question on math.se: given an integer n, return the integer in position n of the sequence [1, 0, -1, 0, 1, 0, ...
• 169
747 views

### The group of sequential positive numbers with the highest sum?

Given the following list of numbers, find the group of sequential positive numbers with the highest sum. Example input: 12 2 35 -1 20 9 76 5 4 -3 4 -5 19 80 32 -1 ...
399 views

### Unfolding an integer

Given the functions L: (x, y) => (2x - y, y) R: (x, y) => (x, 2y - x) and a number N generate a minimal sequence of ...
• 101
8k views

### Jolly Jumper Sequence

A sequence of n > 0 integers is called a jolly jumper if the absolute values of the difference between successive elements take on all the values 1 through n-1. So the sequence [4,1,2,4] has absolute ...
• 295
1k views

### What comes next?

Given a space-separated list of integers, your task is to find the next integer in the sequence. Each integer in the sequence is the result of applying a single mathematical operation(...
• 11.4k
4k views

### Code Golf: 6174 - Kaprekar's mythical constant

Why is the number 6174 so interesting? As defined by Wikipedia Take any four-digit number, using at least two different digits. (Leading zeros are allowed.) Arrange the digits in ascending ...
• 273
688 views

### nth number with n distinct prime factors

A073329 is a sequence where the $n$th term is the $n$th number with exactly $n$ distinct prime factors. For example, $a(3) = 60$ as the first $3$ integers with $3$ distinct prime factors ...
10k views

### Look and say sequence [duplicate]

The look and say sequence is a basic form of run length encoding. The sequence starts with the number 1 and each additional number encodes the number of digits that are repeated before each digit ...
• 3,348
445 views

### The fourth power (Juzuk) [closed]

In 1939 Juzuk described a way to generate the fourth powers of natural numbers. Group the natural numbers like this: ...
• 2,150
5k views

### Carmichael Numbers

Write a program to print Carmichael numbers. The challenge is to print the maximum number of them in less than 5 secs. The numbers should be in increasing order. Please do not use built in functions. ...
• 4,577
44k views

### Fibonacci function or sequence

The Fibonacci sequence is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first ...
• 4,947
Hamming numbers are numbers which evenly divide a power of 60. Equivalently, their prime factors are all $\le 5$. Given a positive integer, print that many Hamming numbers, in order. Rules: Input ...