for challenges involving some sort of sequence.

learn more… | top users | synonyms

7
votes
4answers
320 views

Generate Eban Numbers

(Continuing on the number sequences code-golf, here is an interesting sequence) Eban Numbers (A006933) are the sequence of numbers whose names (in English) do not contain the letter "e" (i.e., "e" is ...
7
votes
15answers
834 views

Generate Recamán's sequence

Recamán's sequence (A005132) is a mathematical sequence, defined as such: A(0) = 0 A(n) = A(n-1) - n if A(n-1) - n > 0 and is new, else A(n) = A(n-1) + n A pretty LaTex version of the above ...
13
votes
8answers
1k views

Generate Hofstadter's Figure-Figure Sequence

In Gödel, Escher, Bach, Douglas Hofstadter introduces an integer sequence which is commonly referred to as the figure-figure sequence: 2, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 16, 17, 19, 20, 21, 22, ...
14
votes
15answers
2k views

Generate Ulam Numbers

Given an integer n (where n < 10001) as input, write a program that will output the first n Ulam numbers. An Ulam number is defined as follows: U1 = 1, U2 = 2. For n > 2, Un is the smallest ...
27
votes
31answers
3k views

Lockers vs. Crackers: The Five-Element Sequence

The Challenge A simple "spy versus spy" challenge. Write a program with the following specifications: The program may be written in any language but must not exceed 512 characters (as represented ...
-9
votes
1answer
109 views

Next number in a squence [closed]

Given a list of five numbers, figure out what should come next. There are many possible answers for each input. For example, the sequence 3 1 4 1 5 might be followed by 9 (the first digits of pi), or ...
0
votes
1answer
136 views

Write a “Look-and-Say Numbers” generator [duplicate]

There is a sequence of numbers called the "Look-and-Say Numbers". Here is an example of the first 5 terms of the sequence, starting at 1 (with spaces added between the digits): 1 1 1 2 ...
6
votes
5answers
482 views

Output nth term in Catalan type sequence

Given a number, starting with 1, create new numbers (children) by taking the last digit, n, and concatenating 1 through n+1. This seems to be a much better explanation of the sequence A071159. ...
12
votes
5answers
484 views

Stack the deck!

Alice and Bob like to play a card game, with a deck of cards numbered with consecutive nonnegative integers. Alice has a very particular way of shuffling the deck, though. First, she takes the top ...
4
votes
3answers
234 views

Pack sequences of non-negative integers

Let N be the set of nonnegative integers, i.e. {0, 1, 2, 3, ...}. Let c0(N) be the set of all infinite sequences in N that converge to 0, i.e. { (xn) ∈ NN | xn → 0 as n → ∞}. ...
-6
votes
3answers
229 views

Challenge to generate a mathematical sequence [closed]

I challenge you to generate the following sequence. 1 2 3 4 5 11 17 23 29 35 76 117 158 199 240 281 603 925 1247 1569 1891 2213 ......N Th term N will be only Input in your code(Any Language) ...
-2
votes
9answers
452 views

I challenge you to generate the following sequence [closed]

I challenge you to generate the following sequence till 100 terms through any programming language in shortest characters possible. The sequence is like this :- 1 2 3 4 5 10 20 30 40 50 100 200 300 ...
-5
votes
1answer
162 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 x = i % 2, y = i / 2, there is probably no beating that. ...
11
votes
4answers
560 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 n. For example, 18 is a practical ...
88
votes
108answers
18k views

4, 8, 15, 16, 23, 42

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 ...
3
votes
6answers
295 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 ...
12
votes
14answers
2k 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 combination should be password. The output ...
19
votes
10answers
2k 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 ...
7
votes
5answers
523 views

Generate Skolem sequences

Beat this I was hanging out with a friend in a pub around 11:00 last night. She told me that a Skolem sequence is a sequence of 2n numbers where every number between 1 and n is repeated twice, and ...
17
votes
2answers
855 views

The number of possible numeric outcomes of parenthesizations of 2^2^…^2

Consider an expression 2^2^...^2 with n operators ^. Operator ^ means exponentiation ("to the power of"). Assume that it has no default assosiativity, so the expression needs to be fully parenthesized ...
8
votes
8answers
469 views

Make a pattern alternate

Problem You are given a sequence of coloured balls (red R and green G). One such possible sequence is: RGGGRRGGRGRRRGGGRGRRRG In as few moves as possible, you must make it so that each ball is a ...
8
votes
3answers
1k 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), ...
7
votes
6answers
347 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 numbers included in s are positive; ...
6
votes
4answers
881 views

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

The look and say sequence is defined as: 1 11 21 1211 111221 312211 13112221 1113213211 Write the shortest program to find the length of a specified term of this sequence without calculating each ...
3
votes
13answers
2k 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 first few numbers in the sequence ...
5
votes
8answers
793 views

Generate a Kolakoski sequence

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 ...
3
votes
9answers
477 views

Generate a valid sequence of numbers with specific rules

The challenge The program must return a valid sequence of numbers into some rules Rules x is the size of the sequence; x cannot be less than 4 or greater than 9 (Thanks David Carraher); Digits of ...
11
votes
3answers
932 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 ...
3
votes
8answers
365 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 Example output: 131 The most ...
6
votes
2answers
315 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 function applications which take the initial pair (0, 1) to a pair which ...
10
votes
26answers
3k 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 ...
13
votes
7answers
783 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(+,-,* or /) to ...
17
votes
20answers
2k 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 ...
15
votes
22answers
2k views

Look and say sequence

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 ...