Questions tagged [sequence]

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

Filter by
Sorted by
Tagged with
9 votes
7 answers
503 views

Distinct Subset Sums: Extending A276661

Consider the integer set \$S = \{3, 5, 6, 7\}\$. If we list all \$2^n\$ subsets of \$S\$ (its powerset) and calculate their sums, we get $$ \mathcal{P}(S) = \{\emptyset, \{3\}, \{5\}, \{6\}, \{7\}, \{...
caird coinheringaahin g's user avatar
24 votes
31 answers
3k views

"-rot" transform

Background -rot transform (read as "minus-rot transform") is a sequence transformation I just invented. This transform is done by viewing the sequence as a stack in Forth or Factor (first ...
Bubbler's user avatar
  • 76k
28 votes
12 answers
2k views

Rows of the Collatz tree

Consider a binary tree built the following way: The root node is \$1\$ For a given node \$n\$: If \$n\$ is odd, its only child is \$2n\$ If \$n\$ is even, one of its children is \$2n\$. If \$\frac {...
caird coinheringaahin g's user avatar
12 votes
8 answers
1k views

Boustrophedon transform

Related: Boustrophedonise, Output the Euler Numbers (Maybe a new golfing opportunity?) Background Boustrophedon transform (OEIS Wiki) is a kind of transformation on integer sequences. Given a sequence ...
Bubbler's user avatar
  • 76k
25 votes
14 answers
2k views

Emanresu numbers

My userid is 100664. In binary this is 11000100100111000. An interesting property of this number is that it can be created entirely by concatenating strings which ...
emanresu A's user avatar
  • 37.8k
13 votes
6 answers
940 views

Eric Angelini's "1995" puzzle

The following puzzle was invented by Eric Angelini in September 2007. As mentioned in A131744 : the sequence is defined by the property that if one writes the English names for the entries, replaces ...
Basto's user avatar
  • 553
5 votes
5 answers
242 views

Potential nonzero entries in an irregular sequence

Background A338268 is a sequence related to a challenge by Peter Kagey. It defines a two-parameter function \$T(n,k)\$, which counts the number of integer sequences \$b_1, \cdots, b_t\$ where \$b_1 + \...
Bubbler's user avatar
  • 76k
12 votes
24 answers
2k views

Third Stirling numbers of the second kind

\$\left\{ n \atop k \right\}\$ or \$S(n, k)\$ is a way of referring to the Stirling numbers of the second kind, the number of ways to partition a set of \$n\$ items into \$k\$ non-empty subsets. For ...
caird coinheringaahin g's user avatar
39 votes
15 answers
2k views

Maximum number of squares touched by a line segment

Consider a square grid on the plane, with unit spacing. A line segment of integer length \$L\$ is dropped at an arbitrary position with arbitrary orientation. The segment is said to "touch" ...
Luis Mendo's user avatar
  • 104k
13 votes
2 answers
277 views

Number of distinct shadow transforms

Background Shadow transform of a 0-based integer sequence \$a(n)\$ is another 0-based integer sequence \$s(n)\$ defined with the following equation: $$ s(n) = \sum_{i=0}^{n-1}{(1 \text{ if } n \text{ ...
Bubbler's user avatar
  • 76k
17 votes
17 answers
2k views

Print this sequence I just made up

To get this sequence I just made up, which will subsequently be referred to as TSIJMU, consider the harmonic series: \$ \frac{1}{2} + \frac{1}{3} + \frac{1}{4} ...\$ But what if you only add a term if ...
emanresu A's user avatar
  • 37.8k
21 votes
10 answers
2k views

Elevator sequence

Totally not inspired by Lyxal repeatedly mentioning elevators in chat :P Challenge In short: simulate some people filling up an elevator and then leaving it. The elevator is simplified as a grid, ...
Bubbler's user avatar
  • 76k
16 votes
15 answers
889 views

Outputting Blum Integers

According to Wikipedia, In mathematics, a natural number \$n\$ is a Blum integer if \$n = p \times q\$ is a semiprime for which \$p\$ and \$q\$ are distinct prime numbers congruent to \$3 \bmod 4\$. ...
user avatar
21 votes
16 answers
3k views

Largest Number with No Repeating Digit Pairs

Inspired by the problem with the same name on Puzzling SE by our very own Dmitry Kamenetsky. You are to find the largest number that only uses every digit pair once, in a given base. For example, in ...
AviFS's user avatar
  • 2,111
19 votes
21 answers
1k views

Binomial transform

Background Binomial transform is a transform on a finite or infinite integer sequence, which yields another integer sequence. The binomial transform of a sequence \$\{a_n\}\$ is given by $$s_n = \sum_{...
Bubbler's user avatar
  • 76k
31 votes
35 answers
2k views

Mr. Binary Counterman

Mr. Binary Counterman, son of Mr. Boolean Masker & Mrs. Even Oddify, follows in his parents’ footsteps and has a peculiar way of keeping track of the digits. When given a list of booleans, he ...
AviFS's user avatar
  • 2,111
4 votes
4 answers
392 views

Reorder it up and down

Given infinite different integers, order them into a sequence \$a_1, a_2, a_3, ...\$ such that \$a_i>a_{i+1}\$ iff \$i\$ is even(or odd, as long as it's constant for all possible inputs and all \$i\...
l4m2's user avatar
  • 23.9k
7 votes
8 answers
577 views

Sums of square roots

Program the sequence \$R_k\$: all numbers that are sum of square roots of some(maybe one) natural numbers \$\left\{\sum_{i\in A}\sqrt i\middle|A\subset \mathbb{N}\right\}\$, in ascending order without ...
l4m2's user avatar
  • 23.9k
11 votes
13 answers
717 views

'Plane' the numbers in any base!

Inspired by this Numberphile video. What is planing? In order to 'plane' a sequence of digits, you need to: Identify the lengths of the 'runs' (adjacently repeated digits) in the sequence. Non-...
Geza Kerecsenyi's user avatar
11 votes
30 answers
2k views

Triangle-style sequences

Consider the triangular numbers and their forward differences: $$ T = 1, 3, 6, 10, 15, 21, ... \\ \Delta T = 2,3,4,5,6, ... $$ If we alter \$\Delta T\$ so that it begins with a different integer, we ...
caird coinheringaahin g's user avatar
26 votes
38 answers
2k views

Sum of first n terms of this series

Given a digit x (between 0 to 9, inclusive) and a number n, calculate the sum of the first n ...
java_learner's user avatar
24 votes
19 answers
1k views

Just Enough Ones

Challenge Given a positive integer \$n\$, count the number of \$n\times n\$ binary matrices (i.e. whose entries are \$0\$ or \$1\$) with exactly two \$1\$'s in each rows and two \$1\$'s in each column....
Delfad0r's user avatar
  • 6,266
16 votes
3 answers
657 views

Compute the uncomputable ... sort of

Implement a function \$f\$ (as a function or complete program), such that \$ \displaystyle\lim_{n\rightarrow \infty} f(n) \$ converges to a number which is not a computable number. Answers will be ...
Wheat Wizard's user avatar
  • 98.5k
22 votes
26 answers
2k views

Delannoy numbers

Consider a grid from \$(0,0)\$ in the bottom-left corner to \$(m,n)\$ in the top-right corner. You begin at \$(0,0)\$, and can only move in one of these three ways: Directly north \$(+0, +1)\$, ...
caird coinheringaahin g's user avatar
21 votes
9 answers
2k views

What's my lucky factor?

Lucky numbers (A000959) are numbers generated by applying the following sieve: Begin with the list of natural numbers: ...
caird coinheringaahin g's user avatar
24 votes
15 answers
2k views

Collatz, Sort, Repeat

Background The Collatz (or 3x+1) map (A006370) is defined as the following: $$ a(n) = \begin{cases} n/2, & \text{if $n$ is even} \\ 3n+1, & \text{if $n$ is odd} \end{cases} $$ Now, let's ...
Bubbler's user avatar
  • 76k
16 votes
12 answers
1k views

Phibonacci - Relation between Phi and Fibonacci

You want to see how quickly the ratio of two consecutive Fibonacci numbers converges on φ. Phi, known by the nickname "the golden ratio" and written as \$φ\$, is an irrational number, almost ...
user avatar
15 votes
17 answers
2k views

Wolstenholme numbers

The generalised harmonic number of order \$m\$ of \$n\$ is $$H_{n,m} = \sum^n_{k=1} \frac 1 {k^m}$$ In this challenge, we'll be considering the generalised harmonic numbers of order \$2\$: $$H_{n,2} = ...
caird coinheringaahin g's user avatar
20 votes
13 answers
929 views

Duplicates in "n × hamming weight of n" sequence

Background The sequence in the title is A245788 "n times the number of 1's in the binary expansion of n" ("times" here means multiplication), which starts like this: ...
Bubbler's user avatar
  • 76k
11 votes
3 answers
361 views

Help me count the Omer

During the 49 days between Passover and Pentecost, Jewish liturgy provides four numerical problems that I've here phrased as code golf problems. Input/Arguments These four, in any order, and by any ...
Adám's user avatar
  • 30.2k
26 votes
4 answers
621 views

The half-step of Fibonacci

Challenge Implement the 1-indexed sequence A054049, which starts like this: ...
Bubbler's user avatar
  • 76k
14 votes
27 answers
1k views

Non-Hamming numbers

Hamming number (also known as regular number) is a number that evenly divides powers of 60. We already have a task to do something with it. This time we are going to do the opposite. I define non-...
user avatar
16 votes
7 answers
834 views

Minimal number of banknotes to pay a bill

Suppose denominations of banknotes follow the infinity Hyperinflation sequence: \$ $1, $2, $5, $10, $20, $50, $100, $200, $500, $1000, $2000, $5000, \cdots \$. How many banknotes are required, at ...
tsh's user avatar
  • 34.7k
18 votes
17 answers
1k views

The meeker number sequence

The Meeker numbers are a 7 digit number in form of \$abcdefg\$, where \$a×b=10c+d\$ and \$d×e=10f+g\$. As an example \$6742612\$ is a meeker number, here \$6×7=10×4+2\$ and \$2×6=10×1+2\$, so it is a ...
Wasif's user avatar
  • 12.3k
13 votes
11 answers
1k views

Variable length Fibonacci word

Challenge For any two non-empty strings A and B, we define the following sequence : F(0) = A F(1) = B F(n) = F(n-1) + F(n-2) Where ...
zdimension's user avatar
17 votes
16 answers
3k views

Number of coins needed to make change

Relatable scenario: I'm going to the store to buy a single item, but only have a $100k bill. As a result, I need exactly $99,979 in change, and in the fewest coins/bills possible because I'm quite ...
Rydwolf Programs's user avatar
15 votes
2 answers
424 views

Connecting the Dots: Counting n²-gons in the n×n Grid

The recent volume of MAA's Mathematics Magazine had an article "Connecting the Dots: Maximal Polygons on a Square Grid" by Sam Chow, Ayla Gafni, and Paul Gafni about making (very convex) \$n^...
Peter Kagey's user avatar
  • 8,679
22 votes
20 answers
2k views

Code the Levine sequence

Introduction Note that I learned it from a Numberphile Video, where Neil Sloane explains it better. I recommend you to watch his Video. But for a quick Introduction: The Levine Sequence is made from ...
math scat's user avatar
  • 9,228
34 votes
3 answers
2k views

Placing circles along a square spiral

In this code golf challenge, you'll be computing the placement of (open) circles of areas \$\pi, 2\pi, 3\pi, \dots\$ when greedily placed along integer points in a square spiral in such a way that no ...
Peter Kagey's user avatar
  • 8,679
12 votes
7 answers
218 views

Generalised Fortunate Prime Sequences

The primorial \$p_n\#\$ is the product of the first \$n\$ primes. The sequence begins \$2, 6, 30, 210, 2310\$. A Fortunate number, \$F_n\$, is the smallest integer \$m > 1\$ such that \$p_n\# + m\$ ...
caird coinheringaahin g's user avatar
19 votes
16 answers
2k views

Self-Replicating Numbers

Background For the purpose of this challenge, all numbers and their string representations are assumed to be in decimal (base 10). I tried to find proper terminology for this challenge, but I do not ...
Zaelin Goodman's user avatar
19 votes
12 answers
985 views

Sociable sequences

Sociable numbers are a generalisation of both perfect and amicable numbers. They are numbers whose proper divisor sums form cycles beginning and ending at the same number. A number is \$n\$-sociable ...
caird coinheringaahin g's user avatar
30 votes
24 answers
2k views

First sequence with no square differences

Consider the sequence \$(a_n)\$ defined in the following way. \$a_0=0\$ For all \$n=1, 2, 3, \dots\$, define \$a_n\$ to be the smallest positive integer such that \$a_n-a_i\$ is not a square number, ...
79037662's user avatar
  • 2,999
41 votes
0 answers
2k views

Topologically distinct ways of dissecting a square into rectangles

I was asked by OEIS contributor Andrew Howroyd to post a Code Golf Challenge to extend OEIS sequence A049021. Would be super great to get a couple more terms for [...] A049021. Kind of thing [...] ...
Peter Kagey's user avatar
  • 8,679
16 votes
15 answers
1k views

Generalise perfect numbers

Let \$\sigma(n)\$ represent the divisor sum of \$n\$ and \$\sigma^m(n)\$ represent the repeated application of the divisor function \$m\$ times. Perfect numbers are numbers whose divisor sum equals ...
caird coinheringaahin g's user avatar
18 votes
7 answers
1k views

Square root multiples

This code-challenge is based on OEIS sequence A261865. \$A261865(n)\$ is the least integer \$k\$ such that some multiple of \$\sqrt{k}\$ is in the interval \$(n,n+1)\$. The goal of this challenge is ...
Peter Kagey's user avatar
  • 8,679
17 votes
2 answers
708 views

Count unrooted, unlabeled binary trees of n nodes

An unrooted binary tree is an unrooted tree (a graph that has single connected component and contains no cycles) where each vertex has exactly one or three neighbors. It is used in bioinformatics to ...
Bubbler's user avatar
  • 76k
20 votes
20 answers
2k views

Fibonacci trees

Background Fibonacci trees \$T_n\$ are a sequence of rooted binary trees of height \$n-1\$. They are defined as follows: \$T_0\$ has no nodes. \$T_1\$ has a single node (the root). The root node of \$...
Bubbler's user avatar
  • 76k
19 votes
24 answers
1k views

Get the length of a Sumac Sequence

Heavily based on this closed challenge. Codidact post, Sandbox Description A Sumac sequence starts with two non-zero integers \$t_1\$ and \$t_2.\$ The next term, \$t_3 = t_1 - t_2\$ More generally, \$...
Razetime's user avatar
  • 27.1k
10 votes
15 answers
1k views

Merge Two Paragraphs with Removing Duplicated Lines

Challenge The goal of this challenge is to make a function that takes two paragraphs and output a concatenated result with removing the duplicated overlapped lines due to redundancy (but a single copy ...
JimmyHu's user avatar
  • 403

1 2 3
4
5
19