Closed gwhitney closed 2 years ago
This also begs the question of how the front end would allow users to access such information.
Some more specific suggestions.
(1) For a URL, we could use: http://[SERVER]/api/get_oeis_factored/[OEIS ID]/[NUM]
(2) In the vast majority of cases where you want the sequence factored for some purpose, you would want to treat -1 differently. But it would be convenient to be able to loop through a list of factors otherwise. So how about an object (dictionary) like
type Factorization = {
sign: BigInt; // either 1 or -1
factors: BigInt[][]; // list of two-element lists [p,e] indicating factor p**e, where p is prime, e is exponent, in increasing order of p
};
Then, someone who wants to iterate through the prime powers can do so easily, and the sign is also easy to call.
Example: -40 becomes { sign: -1, factors: [[2,3],[5,1]] }
Kate also raised two related questions:
On 1 I think the answer should be as close to the same as possible for dealing with missing entries of base sequences (see issue 19 in frontscope), but we haven't settled on that yet.
On 2, I think that factorization should happen in the background on any base sequence that's been requested, and in the interval until that happens, the unfactored entries show up as missing just as if (1) were the case.
The desire to easily look at sequence entries in terms of their prime factorizations is one of the primary motivations/justifications for having a Numberscope backend distinct from the OEIS. This information can be computed just once, and stored for easy access and manipulation in the frontscope, rather than burdening viewers' browsers with performing the factorizations on the client side.