Skip to content

Commit

Permalink
Trac #32695: 5 internet doctests failing in src/sage/databases/oeis.py
Browse files Browse the repository at this point in the history
On Ubuntu 18.04 running 9.5.beta3, the command

{{{
$ sage -t --optional=sage,internet src/sage/databases/oeis.py
}}}

gives

{{{
Using --optional=internet,sage
Doctesting 1 file.
sage -t --random-seed=0 src/sage/databases/oeis.py
**********************************************************************
File "src/sage/databases/oeis.py", line 347, in sage.databases.oeis.OEIS
Failed example:
    fibo.comments()[1]                        # optional -- internet
Expected:
    "F(n+2) = number of binary sequences of length n that have no
    consecutive 0's."
Got:
    'In keeping with historical accounts (see the references by P. Singh
and S. Kak), the generalized Fibonacci sequence a, b, a + b, a + 2b, 2a
+ 3b, 3a + 5b, ... can also be described as the Gopala-Hemachandra
numbers H(n) = H(n-1) + H(n-2), with F(n) = H(n) for a = b = 1, and
Lucas sequence L(n) = H(n) for a = 2, b = 1. - Lekraj Beedassy, Jan 11
2015'
**********************************************************************
File "src/sage/databases/oeis.py", line 542, in
sage.databases.oeis.OEIS.find_by_subsequence
Failed example:
    oeis.find_by_subsequence([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233,
377]) # optional -- internet
Expected:
    0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0
and F(1) = 1.
    1: A212804: Expansion of (1 - x)/(1 - x - x^2).
    2: A177194: Fibonacci numbers whose decimal expansion does not
contain any digit 0.
Got:
    0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0
and F(1) = 1.
    1: A212804: Expansion of (1 - x)/(1 - x - x^2).
    2: A020695: Pisot sequence E(2,3).
**********************************************************************
File "src/sage/databases/oeis.py", line 1506, in
sage.databases.oeis.OEISSequence.references
Failed example:
    w.references()                        # optional -- internet
Expected:
    ...A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY,
1964, p. 52.
    ...
Got:
     0: N. G. W. H. Beeger, On the Congruence (p-1)! == -1 (mod p^2),
Messenger of Mathematics, Vol. 49 (1920), pp. 177-178.
     1: Albert H. Beiler, Recreations in the Theory of Numbers, Dover,
NY, 1964, p. 52.
     2: Calvin C. Clawson, Mathematical Mysteries, Plenum Press, 1996,
p. 180.
     3: Richard Crandall and Carl Pomerance, Prime Numbers: A
Computational Perspective, Springer, NY, 2001; see p. 29.
     4: G. H. Hardy and E. M. Wright, An Introduction to the Theory of
Numbers, 5th ed., Oxford Univ. Press, 1979, th. 80.
     5: G. B. Mathews, Theory of Numbers Part I., Cambridge: Deighton,
Bell and Co., London: George Bell and Sons, 1892, page 318.
     6: Paulo Ribenboim, My Numbers, My Friends: Popular Lectures on
Number Theory, Springer Science & Business Media, 2000, ISBN
0-387-98911-0.
     7: Paulo Ribenboim, The Book of Prime Number Records. Springer-
Verlag, NY, 2nd ed., 1989, p. 277.
     8: N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer
Sequences, Academic Press, 1995 (includes this sequence).
     9: Ilan Vardi, Computational Recreations in Mathematica. Addison-
Wesley, Redwood City, CA, 1991, p. 73.
    10: David Wells, The Penguin Dictionary of Curious and Interesting
Numbers. Penguin Books, NY, 1986, 163.
**********************************************************************
File "src/sage/databases/oeis.py", line 1639, in
sage.databases.oeis.OEISSequence.cross_references
Failed example:
    nbalanced.cross_references(fetch=True)    # optional -- internet
Expected:
    0: A049703: a(0) = 0; for n>0, a(n) = A005598(n)/2.
    1: A049695: Array T read by diagonals; ...
    2: A103116: a(n) = A005598(n) - 1.
    3: A000010: Euler totient function phi(n): count numbers <= n and
prime to n.
Got:
    0: A049703: a(0) = 0; for n>0, a(n) = A005598(n)/2.
    1: A049695: Array T read by diagonals; T(i,j) is the number of
nonnegative slopes of lines determined by 2 lattice points in [ 0,i ] X
[ 0,j ] if i > 0; T(0,j)=1 if j > 0; T(0,0)=0.
    2: A103116: a(n) = Sum_{i=1..n} (n-i+1)*phi(i).
    3: A000010: Euler totient function phi(n): count numbers <= n and
prime to n.
**********************************************************************
File "src/sage/databases/oeis.py", line 1724, in
sage.databases.oeis.OEISSequence.comments
Failed example:
    f.comments()[:3]                      # optional -- internet
Expected:
    0: Also sometimes called Lamé's sequence.
    1: F(n+2) = number of binary sequences of length n that have no
consecutive 0's.
    2: F(n+2) = number of subsets of {1,2,...,n} that contain no
consecutive integers.
Got:
    0: D. E. Knuth writes: "Before Fibonacci wrote his work, the
sequence F_{n} had already been discussed by Indian scholars, who had
long been interested in rhythmic patterns that are formed from one-beat
and two-beat notes. The number of such rhythms having n beats altogether
is F_{n+1}; therefore both Gopāla (before 1135) and Hemachandra (c.
1150) mentioned the numbers 1, 2, 3, 5, 8, 13, 21, ... explicitly."
(TAOCP Vol. 1, 2nd ed.) - _Peter Luschny_, Jan 11 2015
    1: In keeping with historical accounts (see the references by P.
Singh and S. Kak), the generalized Fibonacci sequence a, b, a + b, a +
2b, 2a + 3b, 3a + 5b, ... can also be described as the Gopala-
Hemachandra numbers H(n) = H(n-1) + H(n-2), with F(n) = H(n) for a = b =
1, and Lucas sequence L(n) = H(n) for a = 2, b = 1. - Lekraj Beedassy,
Jan 11 2015
    2: Susantha Goonatilake writes: "[T]his sequence was well known in
South Asia and used in the metrical sciences. Its development is
attributed in part to Pingala (200 BC), later being associated with
Virahanka (circa 700 AD), Gopala (circa 1135), and Hemachandra (circa
1150)—all of whom lived and worked prior to Fibonacci." (Toward a Global
Science: Mining Civilizational Knowledge, p. 126) - _Russ Cox_, Sep 8
2021
**********************************************************************
5 items had failures:
   1 of  20 in sage.databases.oeis.OEIS
   1 of   3 in sage.databases.oeis.OEIS.find_by_subsequence
   1 of   5 in sage.databases.oeis.OEISSequence.comments
   1 of   7 in sage.databases.oeis.OEISSequence.cross_references
   1 of   5 in sage.databases.oeis.OEISSequence.references
    [289 tests, 5 failures, 35.09 s]
----------------------------------------------------------------------
sage -t --random-seed=0 src/sage/databases/oeis.py  # 5 doctests failed
----------------------------------------------------------------------
}}}

URL: https://trac.sagemath.org/32695
Reported by: slabbe
Ticket author(s): David Coudert
Reviewer(s): Sébastien Labbé
  • Loading branch information
Release Manager committed Oct 23, 2021
2 parents 7534061 + 9883de7 commit 5ddfc23
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions src/sage/databases/oeis.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ class OEIS:
sage: fibo.formulas()[4] # optional -- internet
'F(n) = F(n-1) + F(n-2) = -(-1)^n F(-n).'
sage: fibo.comments()[1] # optional -- internet
sage: fibo.comments()[6] # optional -- internet
"F(n+2) = number of binary sequences of length n that have no
consecutive 0's."
Expand Down Expand Up @@ -539,10 +539,10 @@ def find_by_subsequence(self, subsequence, max_results=3, first_result=0):
EXAMPLES::
sage: oeis.find_by_subsequence([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]) # optional -- internet
sage: oeis.find_by_subsequence([2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377]) # optional -- internet
0: A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
1: A212804: Expansion of (1 - x)/(1 - x - x^2).
2: A177194: Fibonacci numbers whose decimal expansion does not contain any digit 0.
2: A020695: Pisot sequence E(2,3).
sage: fibo = _[0] ; fibo # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
Expand Down Expand Up @@ -1504,7 +1504,7 @@ def references(self):
A007540: Wilson primes: primes p such that (p-1)! == -1 (mod p^2).
sage: w.references() # optional -- internet
...A. H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 52.
...Albert H. Beiler, Recreations in the Theory of Numbers, Dover, NY, 1964, p. 52.
...
TESTS::
Expand Down Expand Up @@ -1639,7 +1639,7 @@ def cross_references(self, fetch=False):
sage: nbalanced.cross_references(fetch=True) # optional -- internet
0: A049703: a(0) = 0; for n>0, a(n) = A005598(n)/2.
1: A049695: Array T read by diagonals; ...
2: A103116: a(n) = A005598(n) - 1.
2: A103116: a(n) = Sum_{i=1..n} (n-i+1)*phi(i).
3: A000010: Euler totient function phi(n): count numbers <= n and prime to n.
sage: phi = _[3] # optional -- internet
Expand Down Expand Up @@ -1721,10 +1721,15 @@ def comments(self):
sage: f = oeis(45) ; f # optional -- internet
A000045: Fibonacci numbers: F(n) = F(n-1) + F(n-2) with F(0) = 0 and F(1) = 1.
sage: f.comments()[:3] # optional -- internet
0: Also sometimes called Lamé's sequence.
1: F(n+2) = number of binary sequences of length n that have no consecutive 0's.
2: F(n+2) = number of subsets of {1,2,...,n} that contain no consecutive integers.
sage: f.comments()[:8] # optional -- internet
0: D. E. Knuth writes...
1: In keeping with historical accounts...
2: Susantha Goonatilake writes...
3: Also sometimes called Hemachandra numbers.
4: Also sometimes called Lamé's sequence.
5: ...
6: F(n+2) = number of binary sequences of length n that have no consecutive 0's.
7: F(n+2) = number of subsets of {1,2,...,n} that contain no consecutive integers.
TESTS::
Expand Down

0 comments on commit 5ddfc23

Please sign in to comment.