Ticket #3049 (closed defect: invalid)

Opened 5 years ago

Last modified 4 years ago

combinatorics -- lame overflow with Compositions(n).count() (very easy to fix)

Reported by: was Owned by: mhansen
Priority: major Milestone: sage-duplicate/invalid/wontfix
Component: combinatorics Keywords:
Cc: sage-combinat Work issues:
Report Upstream: Reviewers:
Authors: Merged in:
Dependencies: Stopgaps:

Description (last modified by was) (diff)

The following calculation is trivial, so shouldn't overflow:

sage: len(Compositions(30))
536870912
sage: len(Compositions(40))
Traceback (most recent call last):
...
OverflowError: long int too large to convert to int

This is also lame:

sage: len(Partitions(1000))
Traceback (most recent call last):
...
OverflowError: long int too large to convert to int

Change History

comment:1 Changed 5 years ago by was

  • Description modified (diff)

This is also

comment:2 Changed 5 years ago by was

  • Status changed from new to closed
  • Resolution set to invalid

This is caused by a stupid limitation in Python's len. Use .count, etc. instead.

comment:3 Changed 5 years ago by mabshoff

  • Milestone changed from sage-3.0.1 to sage-duplicate/invalid

comment:4 Changed 4 years ago by nthiery

  • Cc sage-combinat added
Note: See TracTickets for help on using tickets.