Questions tagged [oeis]

The On-Line Encyclopedia of Integer Sequences (OEIS) is an online database of integer sequences.

The On-Line Encyclopedia of Integer Sequences (OEIS), also cited simply as "Sloane's", is an online database of integer sequences, e.g. A000045 [0, 1, 1, 2, 3, 5, 8, 13].

OEIS records information on integer sequences of interest to both professional mathematicians and amateurs and is widely cited. As of 22 August 2015 it contains over 260,000 sequences, making it the largest database of its kind.

Each entry contains the leading terms of the sequence, keywords, mathematical motivations, literature links, and more, including the option to generate a graph or play a musical representation of the sequence. The database is searchable by keyword and by subsequence.

Source: Wikipedia

23 questions
11
votes
2 answers

How does OEIS do subsequence search?

The Online Encyclopedia of Integer Sequences supports search for sequences containing your query as a subsequence, eg. searching for subseq:212,364,420,428 will return the 8*n+4 sequence. (http://oeis.org/search?q=subseq:212,364,420,428) This…
Thomas Ahle
  • 30,774
  • 21
  • 92
  • 114
7
votes
2 answers

First appearance in Stern's Diatomic Sequence

You get an integer n and you need to find the index of its first appearance in Stern's Diatomic Sequence. The sequence is defined like this: a[0] = 0 a[1] = 1 a[2*i] = a[i] a[2*i+1] = a[i] + a[i+1] See MathWorld. Because n can be up to…
dragostis
  • 2,574
  • 2
  • 20
  • 39
6
votes
1 answer

"cabal install happy" causes memory overflow. (GHC 7.8.2)

I've been trying to get happy to install correctly for the past couple days, and while I found it challenging to get cabal install happy to not just error (by installing happy-1.19 with apt-get and adding /opt/happy/1.19.3/bin to PATH), now it runs…
SplinterOfChaos
  • 469
  • 3
  • 12
5
votes
3 answers

Algorithm improvement for enumerating binary trees

Currently I can enumerate rooted planar unlabeled binary trees using the following brute-force Prolog code. e --> u | b | t. u --> ['[op(u),['], e, [']]']. b --> ['[op(b),['], e, [','], e, [']]']. t --> ['number(n)']. Note: See output listings…
Guy Coder
  • 24,501
  • 8
  • 71
  • 136
5
votes
3 answers

Quickly generating the "triangle sequence": avoiding mispredictions

I'm interested in calculating the triangle sequence1, which is the sequence of pairs (i, j): (0, 0), (1, 0), (1, 1), (2, 0), (2, 1) ... which iterates though all pairs (i, j) with the restriction that i >= j. The same sequence with but with the…
BeeOnRope
  • 60,350
  • 16
  • 207
  • 386
5
votes
2 answers

Prolog: calculating OEIS A031877 ("nontrivial reversal numbers") using clp(FD)

Browsing through the awesome On-Line Encyclopedia of Integer Sequences (cf. en.wikipedia.org), I stumbled upon the following integer sequence: A031877: Nontrivial reversal numbers (numbers which are integer multiples of their reversals), excluding…
repeat
  • 18,496
  • 4
  • 54
  • 166
3
votes
2 answers

Finding certain arrangements of all 2-combinatons for a given list

Given a list L of an even number (2k) of elements, I'm looking for an algorithm to produce a list of 2k-1 sublists with the following properties: each sublist includes exactly k 2-combinations (pairs where the order does not matter) of elements…
siracusa
  • 3,286
  • 1
  • 10
  • 19
3
votes
1 answer

Forth, Hofstadter Q Sequence with Recursion

I'm attempting to implement Hofstadter's Q Sequence using the recursive definition: Q(1) = 1 Q(2) = 1 Q(n) = Q(n - Q(n-2)) + Q(n - Q(n-1)) for n > 2 I get the wrong result for n > 3. Here's what I have so far: : Q recursive dup 3 < if …
mbomb007
  • 3,788
  • 3
  • 39
  • 68
3
votes
1 answer

Number of different rolls of K N-sided dice

I needed to calculate the number of different possible rolls that could arise from rolling K dice, each with N-sides. My definition of roll is that something like {1, 1, 2, 3, 4} is equivalent to {1, 4, 3, 1, 2} (order doesn't matter), but not to…
algorithmshark
  • 267
  • 2
  • 9
1
vote
3 answers

How does database query time scale with database size?

I was recently on the OEIS (Online Encyclopedia of Integer Sequences) recently, trying to look up a particular sequence I had on had. Now, this database is fairly large. The website states that if the 2006 (! 5 years old) edition were printed, it…
Mike Bailey
  • 12,479
  • 14
  • 66
  • 123
1
vote
1 answer

Algorithm to generate all preorders/weak orders of size n

I'm looking for a halfway efficient algorithm that, given an input set, generates all total preorder relations from it (or, equivalently, all weak orders). You could also call it all preferential arrangements of n labeled elements. I have already…
1
vote
3 answers

Finding the general term of this sequence

I have been challenged to find the general term or the recurrence relation for this sequence 5,18,44,96,195.... The only hint I have is that this sequence is an applied Fibonacci sequence. Can someone please suggest ways to find the recurrence or…
thedarkknight
  • 147
  • 2
  • 8
0
votes
0 answers

Efficient program (any language) for calculating OEIS sequence A229037

I have been exploring OEIS sequence A229037 aka "fractal smoke" and am trying to write some efficient code to produce it. I also want to look at variations of the sequence (e.g. what does the lexographically 2nd sequence that doesn't include…
0
votes
1 answer

Can I define a regular polyline function in one line?(1)y=x,y=0

Can I define a line function in one line because it is regular? graph orenge line : myPoly Conditions : The image oscillates between Y=0 and Y=X. The slope of the line is 2 or -2. You can start with (2,0). I want ①Is it possible to define the…
mrrclb46z
  • 89
  • 6
0
votes
1 answer

Download OEIS sequences with known algorithm to produce them

I was reading some interesting questions about the topic "Can we make a program that, given a particular sequence, produces the next terms", like this one, and I really like the detailed answer of this one. I understand that the answer is "That's…
AnilCh
  • 113
  • 6
1
2