ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 17 Mar 2017 05:23:53 +0100Sage code that receives a symmetric partition as an input and returns the corresponding partition with odd parts.https://ask.sagemath.org/question/36965/sage-code-that-receives-a-symmetric-partition-as-an-input-and-returns-the-corresponding-partition-with-odd-parts/ I am a beginner in Sage . I Just got how to find number of partitions and cardinality of partitions. But this questions is being complicated to me. Please help. Thu, 16 Mar 2017 14:14:32 +0100https://ask.sagemath.org/question/36965/sage-code-that-receives-a-symmetric-partition-as-an-input-and-returns-the-corresponding-partition-with-odd-parts/Answer by fidbc for <p>I am a beginner in Sage . I Just got how to find number of partitions and cardinality of partitions. But this questions is being complicated to me. Please help. </p>
https://ask.sagemath.org/question/36965/sage-code-that-receives-a-symmetric-partition-as-an-input-and-returns-the-corresponding-partition-with-odd-parts/?answer=36967#post-id-36967Not sure if what you meant was to convert a partition with all parts distinct to a partition where each part is odd. If it was, then, following the bijection from page 10 [here](https://www.math.upenn.edu/~wilf/PIMS/PIMSLectures.pdf) and assuming you are representing a partition `p` as a list of natural numbers results in something of the form:
sorted([x.odd_part() for x in p for i in range(x/x.odd_part())],reverse=True)Fri, 17 Mar 2017 05:23:53 +0100https://ask.sagemath.org/question/36965/sage-code-that-receives-a-symmetric-partition-as-an-input-and-returns-the-corresponding-partition-with-odd-parts/?answer=36967#post-id-36967