Skip to content

Need ability to obtain sequence values incrementally #157

@gwhitney

Description

@gwhitney

Currently, there are only endpoints for obtaining initial subsequences of sequences -- you can get the first N elements, but you can't get the Mth through the Nth. it seems this lack is making it difficult to pass regression tests in frontscope -- they time out waiting for large sequences like A000521 (as far as I can tell). Therefore, I propose to add the following two endpoints:

  • api/get_oeis_header/Annnnnn
    This will return the name, first and last indices, and a "chunk size" (typically 1024) for the sequence.
  • api/get_oeis_chunk/Annnnnn/x
    This will return the entries with indices x*chunk_size through (x+1)*chunk_size - 1, inclusive, if any, for the sequence, where chunk_size is as returned by get_oeis_header for this sequence. Note negative values of x are allowed, and indeed necessary to get all entries of any sequence with a negative offset. Note that if the sequence does not have an entry for an index in the chunk, that entry is simply omitted entirely from the return (there is no placeholder), so it may be that not all indices in the range are represented in the return.

@katestange @Vectornaut I welcome any thoughts on this design. I am starting on the implementation immediately in hopes of getting numberscope/frontscope#420 unjammed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions