oeis2

Interface for Online Encyclopedia of Integer Sequences (OEIS).

https://github.com/23prime/oeis2#readme

Version on this page:1.0.3
LTS Haskell 19.7:1.0.7
Stackage Nightly 2022-03-22:1.0.7
Latest on Hackage:1.0.7@rev:1

See all snapshots oeis2 appears in

BSD-3-Clause licensed by Taisuke Hikawa
Maintained by [email protected]
This version can be pinned in stack with:oeis2-1.0.3@sha256:14c3b6fb68ff1dc0ad0e8791f679656fb2118405256a922b5b0ab4d699f51770,1760

Module documentation for 1.0.3

oeis2

Travis Build Status Haskell Hackage version Stackage version BSD3

Haskell interface for Online Encyclopedia of Integer Sequences; homage to oeis.

Difference from oeis

  • Source data of OEIS.
    : oeis use fmt=text, but this library use fmt=json.
  • Possible to get all search results.
  • Search functions from ID or sub-sequence are merged.
  • Possibele to search from other than ID or sub-sequence.
  • Support for HTTPS.

Usage

Add import statement.

import Math.OEIS
  • Get all search results from sub-sequence

    • If n == 0, you get all search results.

      ghci>searchSeq (SubSeq [1,2,3,4]) 0
      [OEIS {number = "A000027", ids = ["M0472","N0173"], seqData = [1,2,3,4,5,6,7,...
      ghci>length it
      53
      
    • Otherwise, you get first n search results.

      ghci>searchSeq (SubSeq [1,2,3,4]) 17
      [OEIS {number = "A000027", ids = ["M0472","N0173"], seqData = [1,2,3,4,5,6,7,8,9,
      ghci>length it
      17
      
  • Get first few terms from sub-sequence

    ghci>getSeqData (SubSeq [1,2,2,3,3,3,4,4,4,4])
    Just [1,2,2,3,3,3,4,4,4,4,5,5,5,5,5,6,6,6,6,6,6,7,7,7,7,7,7,7,...
    
  • Get Mathematica function from sub-sequence

    ghci>mathematica <$> lookupSeq (SubSeq [1,2,2,3,3,3,4,4,4,4])
    Just ["a[1] = 1; a[n_] := a[n] = a[n - a[n - 1]] + 1 (* _Branko Curgus_, May 12 2009 *)","Table[n, {n, 13}, {n}] // Flatten (* _Robert G. Wilson v_, May 11 2010 *)"]
    
  • If no search result

    ghci>lookupSeq (ID "1145141919893")
    Nothing