for challenges involving some sort of sequence.

learn more… | top users | synonyms

6
votes
5answers
458 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
455 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
231 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
212 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
442 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
155 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
528 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 ...
85
votes
107answers
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
288 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
519 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
837 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
461 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
340 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; ...
5
votes
4answers
823 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 ...
2
votes
13answers
1k 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 ...
4
votes
8answers
745 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 ...
2
votes
9answers
466 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 ...
10
votes
3answers
882 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 ...
2
votes
8answers
361 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 ...
5
votes
2answers
303 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 ...
8
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 ...
12
votes
7answers
769 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 ...
16
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 ...
14
votes
21answers
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 ...