# A defect in the first_terms function in the OEIS module

oeis(17).first_terms(12)


throws the

TypeError: You found a sign inconsistency, please contact OEIS


The sequence A000017 is 'dead', what means it has errors in the data and was replaced by another version. It is policy of the OEIS to keep such sequences so they can be found in the case they are referenced in the literature.

I think the OEIS functions should simply ignore sequences with the keyword 'dead'. At least they should not attempt to return terms of these sequences.

edit retag close merge delete

Hi. You are definitely right! Thanks for the report. This is not really a question though. Do you know how to open a ticket (http://trac.sagemath.org)? If you have time and you know how to fix it, you are very welcome to contribute...

( 2014-11-13 00:39:23 +0200 )edit

Yes, you are right, this is not a real question, sorry. I have opened now the ticket http://trac.sagemath.org/ticket/17330#ticket

( 2014-11-13 00:57:41 +0200 )edit

Sort by » oldest newest most voted

Great, i am happy this error happens, some detection procedure worked ! In this case, Sage's OEIS module refuses to provide the first terms because of an inconsistency in the database : there is not enough information in the keywords to decide whether the sequence is signed or not. When the module was written, the keyword dead was not specified (or perhaps i missed it!), which explains that it is not specifically handled. What is handled here is the lack of other keywords that have been removed. I tried to follow strictly the keyword specifications, since they determine the behavior of the sequence as a Sage object. It is indeed not so hard to fix, so as suggested by @vdelecroix, you could try to fix this if you want, and ask for help if needed.

If you are maintaining the (upstream) OEIS, may i take the opportunity to advocate some improvements in those keywords. For example, there is a finit keyword to ensure that the sequence is finite, but no keyword to claim "we know that this sequence is infinite", hence no distinction can be done between, for example, the Fibonacci sequence (A000045) which is known to be infinite and the twin primes (A001359), whose finiteness is an open problem, which leads to the following poor behavior:

sage: oeis(45).is_finite()
Unknown


While we should be able to answer False.

Also, i do not remember precisely which sequences, but i noticed that some keywords are used in a weaker sense than their specification. For example cofr means that the sequence is the sequence of convergents of some particular number. Unfortunately, it is sometimes used for a sequence of digits of an irrational number whose definition involves continued fractions, or the sequence of denominators of the approximants of the continued fraction. In such case, it makes no sense anymore to transform the sequence into a continued fraction.

more