code
stringlengths
17
6.64M
class A000041(SloaneSequence): def __init__(self): '\n `a(n)` = number of partitions of `n` (the partition\n numbers).\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sl...
class A000045(SloaneSequence): def __init__(self): '\n Sequence of Fibonacci numbers, offset 0,4.\n\n REFERENCES:\n\n - S. Plouffe, Project Gutenberg, The First 1001 Fibonacci\n Numbers,\n http://ibiblio.org/pub/docs/books/gutenberg/etext01/fbncc10.txt\n\n We...
class A000108(SloaneSequence): def __init__(self): '\n Catalan numbers:\n `C_n = \\frac{\\binom{2n}{n}}{n+1} = \\frac{(2n)!}{n!(n+1)!}`.\n\n Also called Segner numbers.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- functio...
class A001006(SloaneSequence): def __init__(self): '\n Motzkin numbers: number of ways of drawing any number of\n nonintersecting chords among `n` points on a circle.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n...
class A000079(SloaneSequence): def __init__(self): '\n Powers of 2: `a(n) = 2^n`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000079;a\n Powers of 2: a(n...
class A000578(SloaneSequence): def __init__(self): '\n The cubes: `a(n) = n^3`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000578;a\n The cubes: n^3\n ...
class A000244(SloaneSequence): def __init__(self): '\n Powers of 3: `a(n) = 3^n`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000244;a\n Powers of 3: a(n...
class A000302(SloaneSequence): def __init__(self): '\n Powers of 4: `a(n) = 4^n`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000302;a\n Powers of 4: a(n...
class A000583(SloaneSequence): def __init__(self): '\n Fourth powers: `a(n) = n^4`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000583;a\n Fourth powers:...
class A000142(SloaneSequence): def __init__(self): '\n Factorial numbers: `n! = 1 \\cdot 2 \\cdot 3 \\cdots n`\n\n Order of symmetric group `S_n`, number of permutations of\n `n` letters.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``i...
class A000085(SloaneSequence): def __init__(self): '\n Number of self-inverse permutations on `n` letters, also\n known as involutions; number of Young tableaux with `n`\n cells.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` ...
class A001189(SloaneSequence): def __init__(self): '\n Number of degree-n permutations of order exactly 2.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A001189;a\n ...
class A000670(SloaneSequence): def __init__(self): '\n Number of preferential arrangements of `n` labeled\n elements; or number of weak orders on `n` labeled\n elements.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- functi...
class A006318(SloaneSequence): def __init__(self): '\n Large Schroeder numbers.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A006318;a\n Large Schroeder nu...
class A000165(SloaneSequence): def __init__(self): '\n Double factorial numbers: `(2n)!! = 2^n*n!`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000165;a\n ...
class A001147(SloaneSequence): def __init__(self): '\n Double factorial numbers:\n `(2n-1)!! = 1 \\cdot 3 \\cdot 5 \\cdots (2n-1)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A006882(SloaneSequence): def __init__(self): '\n Double factorials `n!!`: `a(n)=n \\cdot a(n-2)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A006882;a\n ...
class A000984(SloaneSequence): def __init__(self): '\n Central binomial coefficients:\n `\\binom{2n}{n} = \\frac {(2n)!} {(n!)^2}`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A001405(SloaneSequence): def __init__(self): '\n Central binomial coefficients:\n `\\binom{n}{\\lfloor \\frac {n}{ 2} \\rfloor}`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A000292(SloaneSequence): def __init__(self): '\n Tetrahedral (or pyramidal) numbers:\n `\\binom{n+2}{3} = n(n+1)(n+2)/6`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sag...
class A000330(SloaneSequence): def __init__(self): '\n Square pyramidal numbers"\n `0^2 + 1^2 \\cdots n^2 = n(n+1)(2n+1)/6`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: ...
class ExtremesOfPermanentsSequence(SloaneSequence): def _precompute(self, how_many=20): '\n EXAMPLES::\n\n sage: sloane.A000153._precompute()\n sage: v1 = len(sloane.A000153._b)\n sage: sloane.A000153._precompute(10)\n sage: len(sloane.A000153._b) - v1\n...
class A000153(ExtremesOfPermanentsSequence): def __init__(self): '\n `a(n) = n*a(n-1) + (n-2)*a(n-2)`, with `a(0) = 0`,\n `a(1) = 1`.\n\n With offset 1, permanent of (0,1)-matrix of size\n `n \\times (n+d)` with `d=2` and `n` zeros\n not on a line. This is a special cas...
class A000255(ExtremesOfPermanentsSequence): def __init__(self): '\n `a(n) = n*a(n-1) + (n-1)*a(n-2)`, with `a(0) = 1`,\n `a(1) = 1`.\n\n With offset 1, permanent of (0,1)-matrix of size\n `n \\times (n+d)` with `d=1` and `n` zeros\n not on a line. This is a special cas...
class A000261(ExtremesOfPermanentsSequence): def __init__(self): '\n `a(n) = n*a(n-1) + (n-3)*a(n-2)`, with `a(1) = 1`,\n `a(2) = 1`.\n\n With offset 1, permanent of (0,1)-matrix of size\n `n \\times (n+d)` with `d=3` and `n` zeros\n not on a line. This is a special cas...
class A001909(ExtremesOfPermanentsSequence): def __init__(self): '\n `a(n) = n*a(n-1) + (n-4)*a(n-2)`, with `a(2) = 0`,\n `a(3) = 1`.\n\n With offset 1, permanent of (0,1)-matrix of size\n `n \\times (n+d)` with `d=4` and `n` zeros\n not on a line. This is a special cas...
class A001910(ExtremesOfPermanentsSequence): def __init__(self): '\n `a(n) = n*a(n-1) + (n-5)*a(n-2)`, with `a(3) = 0`,\n `a(4) = 1`.\n\n With offset 1, permanent of (0,1)-matrix of size\n `n \\times (n+d)` with `d=5` and `n` zeros\n not on a line. This is a special cas...
class ExtremesOfPermanentsSequence2(ExtremesOfPermanentsSequence): def gen(self, a0, a1, d): '\n EXAMPLES::\n\n sage: from sage.combinat.sloane_functions import ExtremesOfPermanentsSequence2\n sage: e = ExtremesOfPermanentsSequence2()\n sage: it = e.gen(6,43,6)\n ...
class A090010(ExtremesOfPermanentsSequence2): def __init__(self): '\n Permanent of (0,1)-matrix of size `n \\times (n+d)` with\n `d=6` and `n` zeros not on a line.\n\n ` a(n) = (n+5)*a(n-1) + (n-1)*a(n-2), a(1)=6, a(2)=43`.\n\n This is a special case of Theorem 2.3 of Seok-Zun...
class A055790(ExtremesOfPermanentsSequence2): def __init__(self): '\n `a(n) = n*a(n-1) + (n-2)*a(n-2) [a(0) = 0, a(1) = 2]`.\n\n With offset 1, permanent of (0,1)-matrix of size n X (n+d) with d=1\n and n-1 zeros not on a line. This is a special case of Theorem 2.3\n of Seok-Z...
class A090012(SloaneSequence): def __init__(self): '\n Permanent of (0,1)-matrix of size `n \\times (n+d)` with\n `d=2` and `n-1` zeros not on a line.\n\n `a(n) = (n+1)*a(n-1) + (n-2)*a(n-2)`, `a(1)=3` and\n `a(2)=9`\n\n This is a special case of Theorem 2.3 of Seok-Zun...
class A090013(SloaneSequence): def __init__(self): '\n Permanent of (0,1)-matrix of size `n \\times (n+d)` with\n `d=3` and `n-1` zeros not on a line.\n\n `a(n) = (n+1)*a(n-1) + (n-2)*a(n-2) [a(1)=4, a(2)=16]`\n\n This is a special case of Theorem 2.3 of Seok-Zun Song et al.\n...
class A090014(SloaneSequence): def __init__(self): '\n Permanent of (0,1)-matrix of size `n \\times (n+d)` with\n `d=4` and `n-1` zeros not on a line.\n\n `a(n) = (n+1)*a(n-1) + (n-2)*a(n-2) [a(1)=5, a(2)=25]`\n\n This is a special case of Theorem 2.3 of Seok-Zun Song et al.\n...
class A090015(SloaneSequence): def __init__(self): '\n Permanent of (0,1)-matrix of size `n \\times (n+d)` with\n `d=5` and `n-1` zeros not on a line.\n\n `a(n) = (n+1)*a(n-1) + (n-2)*a(n-2) [a(1)=6, a(2)=36]`\n\n This is a special case of Theorem 2.3 of Seok-Zun Song et al.\n...
class A090016(SloaneSequence): def __init__(self): '\n Permanent of (0,1)-matrix of size `n \\times (n+d)` with\n `d=6` and `n-1` zeros not on a line.\n\n `a(n) = (n+1)*a(n-1) + (n-2)*a(n-2) [a(1)=7, a(2)=49]`\n\n `A090016 a(n) = A090010(n-1) + A090010(n), a(1)=7`\n\n T...
class A000166(SloaneSequence): def __init__(self): "\n Subfactorial or rencontres numbers, or derangements: number of\n permutations of `n` elements with no fixed points.\n\n With offset 1 also the permanent of a (0,1)-matrix of order\n `n` with `n` 0's not on a line.\n\n ...
class A000203(SloaneSequence): def __init__(self): '\n The sequence `\\sigma(n)`, where `\\sigma(n)` is the\n sum of the divisors of `n`. Also called\n `\\sigma_1(n)`.\n\n The function ``sigma(n, k)`` implements\n `\\sigma_k(n)` in Sage.\n\n INPUT:\n\n - `...
class A001157(SloaneSequence): def __init__(self): '\n The sequence `\\sigma_2(n)`, sum of squares of divisors of\n `n`.\n\n The function sigma(n, k) implements `\\sigma_k*` in Sage.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``intege...
class A008683(SloaneSequence): def __init__(self): '\n Möbius function `\\mu(n)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A008683;a\n Moebius function...
class A000204(SloaneSequence): def __init__(self): '\n Lucas numbers (beginning with 1): `L(n) = L(n-1) + L(n-2)`\n with `L(1) = 1`, `L(2) = 3`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n...
class A000217(SloaneSequence): def __init__(self): '\n Triangular numbers: `a(n) = \\binom{n+1}{2} = n(n+1)/2`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000217;a...
class A000124(SloaneSequence): def __init__(self): "\n Central polygonal numbers (the Lazy Caterer's sequence):\n `n(n+1)/2 + 1`.\n\n Or, maximal number of pieces formed when slicing a pancake with\n `n` cuts.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n ...
class A002275(SloaneSequence): def __init__(self): '\n Repunits: `\\frac {(10^n - 1)}{9}`. Often denoted by\n `R_n`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloa...
def recur_gen2b(a0, a1, a2, a3, b): '\n Inhomogeneous second-order linear recurrence generator with fixed\n coefficients and `b = f(n)`\n\n `a(0) = a0`, `a(1) = a1`,\n `a(n) = a2*a(n-1) + a3*a(n-2) +f(n)`.\n\n EXAMPLES::\n\n sage: from sage.combinat.sloane_functions import recur_gen2b\n ...
class RecurrenceSequence(SloaneSequence): def _precompute(self, how_many=20): '\n EXAMPLES::\n\n sage: initial = len(sloane.A001110._b)\n sage: sloane.A001110._precompute(10)\n sage: len(sloane.A001110._b) - initial == 10\n True\n ' try: ...
class A001110(RecurrenceSequence): def __init__(self): '\n Numbers that are both triangular and square:\n `a(n) = 34a(n-1) - a(n-2) + 2`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A051959(RecurrenceSequence): def __init__(self): '\n Linear second order recurrence. A051959.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A051959; a\n ...
class A001221(SloaneSequence): def __init__(self): '\n Number of different prime divisors of `n`\n\n Also called omega(n) or `\\omega(n)`. Maximal number of\n terms in any factorization of `n`. Number of prime powers\n that divide `n`.\n\n INPUT:\n\n - ``n`` -- n...
class A001222(SloaneSequence): def __init__(self): '\n Number of prime divisors of `n` (counted with\n multiplicity).\n\n Also called bigomega(n) or `\\Omega(n)`. Maximal number of\n terms in any factorization of `n`. Number of prime powers\n that divide `n`.\n\n ...
class A046660(SloaneSequence): '\n Excess of `n` = number of prime divisors (with\n multiplicity) - number of prime divisors (without multiplicity).\n\n `\\Omega(n) - \\omega(n)`.\n\n INPUT:\n\n - ``n`` -- positive integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A001227(SloaneSequence): def __init__(self): '\n Number of odd divisors of `n`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A001227; a\n Number of o...
class A001358(SloaneSequence): def __init__(self): '\n Products of two primes.\n\n These numbers have been called semiprimes (or semi-primes),\n biprimes or 2-almost primes.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- fu...
class A001694(SloaneSequence): def __init__(self): '\n This function returns the `n`-th Powerful Number:\n\n A positive integer `n` is powerful if for every prime\n `p` dividing `n`, `p^2` also divides\n `n`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n ...
class A001836(SloaneSequence): def __init__(self): "\n Numbers `n` such that `\\phi(2n-1) < \\phi(2n)`,\n where `\\phi` is Euler's totient function.\n\n Euler's totient function is also known as euler_phi, euler_phi is\n a standard Sage function.\n\n INPUT:\n\n -...
def recur_gen2(a0, a1, a2, a3): '\n homogeneous general second-order linear recurrence generator with\n fixed coefficients\n\n a(0) = a0, a(1) = a1, a(n) = a2\\*a(n-1) + a3\\*a(n-2)\n\n EXAMPLES::\n\n sage: from sage.combinat.sloane_functions import recur_gen2\n sage: it = recur_gen2(1,1...
class RecurrenceSequence2(SloaneSequence): def _precompute(self, how_many=150): '\n EXAMPLES::\n\n sage: initial = len(sloane.A001906._b)\n sage: sloane.A001906._precompute(10)\n sage: len(sloane.A001906._b) - initial == 10\n True\n ' try:...
class A001906(RecurrenceSequence2): def __init__(self): '\n `F(2n) =` bisection of Fibonacci sequence:\n `a(n)=3a(n-1)-a(n-2)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sag...
class A001333(RecurrenceSequence2): def __init__(self): '\n Numerators of continued fraction convergents to `\\sqrt 2`.\n\n See also A000129\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A001045(RecurrenceSequence2): def __init__(self): '\n Jacobsthal sequence: `a(n) = a(n-1) + 2a(n-2)`,\n `a(0) = 0` and `a(1) = 1`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A000129(RecurrenceSequence2): def __init__(self): '\n Pell numbers: `a(0) = 0`, `a(1) = 1`; for\n `n > 1`, `a(n) = 2a(n-1) + a(n-2)`.\n\n Denominators of continued fraction convergents to\n `\\sqrt 2`.\n\n See also A001333\n\n INPUT:\n\n - ``n`` -- n...
class A001109(RecurrenceSequence2): def __init__(self): '\n `a(n)^2` is a triangular number:\n `a(n) = 6*a(n-1) - a(n-2)` with `a(0)=0`,\n `a(1)=1`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n E...
class A015521(RecurrenceSequence2): def __init__(self): '\n Linear 2nd order recurrence, `a(0)=0`, `a(1)=1` and\n `a(n) = 3 a(n-1) + 4 a(n-2)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\...
class A015523(RecurrenceSequence2): def __init__(self): '\n Linear 2nd order recurrence, `a(0)=0`, `a(1)=1` and\n `a(n) = 3 a(n-1) + 5 a(n-2)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\...
class A015530(RecurrenceSequence2): def __init__(self): '\n Linear 2nd order recurrence, `a(0)=0`, `a(1)=1` and\n `a(n) = 4 a(n-1) + 3 a(n-2)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\...
class A015531(RecurrenceSequence2): def __init__(self): '\n Linear 2nd order recurrence, `a(0)=0`, `a(1)=1` and\n `a(n) = 4 a(n-1) + 5 a(n-2)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\...
class A015551(RecurrenceSequence2): def __init__(self): '\n Linear 2nd order recurrence, `a(0)=0`, `a(1)=1` and\n `a(n) = 6 a(n-1) + 5 a(n-2)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\...
class A082411(RecurrenceSequence2): def __init__(self): '\n Second-order linear recurrence sequence with\n `a(n) = a(n-1) + a(n-2)`.\n\n `a(0) = 407389224418`, `a(1) = 76343678551`. This\n is the second-order linear recurrence sequence with `a(0)`\n and `a(1)` co-prime,...
class A083103(RecurrenceSequence2): def __init__(self): '\n Second-order linear recurrence sequence with\n `a(n) = a(n-1) + a(n-2)`.\n\n `a(0) = 1786772701928802632268715130455793`,\n `a(1) = 1059683225053915111058165141686995`. This is the\n second-order linear recurre...
class A083104(RecurrenceSequence2): def __init__(self): '\n Second-order linear recurrence sequence with\n `a(n) = a(n-1) + a(n-2)`.\n\n `a(0) = 331635635998274737472200656430763`,\n `a(1) = 1510028911088401971189590305498785`. This is the\n second-order linear recurren...
class A083105(RecurrenceSequence2): def __init__(self): '\n Second-order linear recurrence sequence with\n `a(n) = a(n-1) + a(n-2)`.\n\n `a(0) = 62638280004239857`,\n `a(1) = 49463435743205655`. This is the second-order linear\n recurrence sequence with `a(0)` and `a(1)...
class A083216(RecurrenceSequence2): def __init__(self): '\n Second-order linear recurrence sequence with\n `a(n) = a(n-1) + a(n-2)`.\n\n `a(0) = 20615674205555510`,\n `a(1) = 3794765361567513`. This is a second-order linear\n recurrence sequence with `a(0)` and `a(1)` c...
class A061084(SloaneSequence): def __init__(self): "\n Fibonacci-type sequence based on subtraction: `a(0) = 1`,\n `a(1) = 2` and `a(n) = a(n-2)-a(n-1)`.\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXA...
def recur_gen3(a0, a1, a2, a3, a4, a5): '\n homogeneous general third-order linear recurrence generator with\n fixed coefficients\n\n a(0) = a0, a(1) = a1, a(2) = a2, a(n) = a3\\*a(n-1) + a4\\*a(n-2) +\n a5\\*a(n-3)\n\n EXAMPLES::\n\n sage: from sage.combinat.sloane_functions import recur_ge...
class A000213(SloaneSequence): def __init__(self): '\n Tribonacci numbers: a(n) = a(n-1) + a(n-2) + a(n-3). Starting with\n 1, 1, 1, ...\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
class A000073(SloaneSequence): def __init__(self): '\n Tribonacci numbers: a(n) = a(n-1) + a(n-2) + a(n-3). Starting with\n 0, 0, 1, ...\n\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n ...
def perm_mh(m, h): "\n This functions calculates `f(g,h)` from Sloane's sequences\n A079908-A079928\n\n INPUT:\n\n - ``m`` -- positive integer\n - ``h`` -- non negative integer\n\n OUTPUT: permanent of the `m \\times (m+h)` matrix, etc.\n\n EXAMPLES::\n\n sage: from sage.combinat.sloan...
class A079922(SloaneSequence): "\n function returns solutions to the Dancing School problem with\n `n` girls and `n+3` boys.\n\n The value is `per(B)`, the permanent of the (0,1)-matrix\n `B` of size `n \\times n+3` with `b(i,j)=1`\n if and only if `i \\le j \\le i+n`.\n\n REFERENCES:\n\n - J...
class A079923(SloaneSequence): "\n function returns solutions to the Dancing School problem with\n `n` girls and `n+4` boys.\n\n The value is `per(B)`, the permanent of the (0,1)-matrix\n `B` of size `n \\times n+3` with `b(i,j)=1`\n if and only if `i \\le j \\le i+n`.\n\n REFERENCES:\n\n - J...
class A109814(SloaneSequence): '\n The `n` th term of the sequence `a(n)` is the\n largest `k` such that `n` can be written as sum of\n `k` consecutive integers.\n\n By definition, `n` is the sum of at most `a(n)` consecutive\n positive integers. Suppose `n` is to be written as sum of `k`\n cons...
class A111774(SloaneSequence): def __init__(self): '\n Sequence of numbers of the third kind, i.e., numbers that can be\n written as a sum of at least three consecutive positive integers.\n\n Odd primes can only be written as a sum of two consecutive\n integers. Powers of 2 do...
class A111775(SloaneSequence): def __init__(self): '\n Number of ways `n` can be written as a sum of at least\n three consecutive integers.\n\n Powers of 2 and (odd) primes can not be written as a sum of at\n least three consecutive integers. `a(n)` strongly depends\n o...
class A111787(SloaneSequence): def __init__(self): "\n This function returns the `n`-th number of Sloane's\n sequence A111787\n\n `a(n)=0` if `n` is an odd prime or a power of 2.\n For numbers of the third kind (see A111774) we proceed as follows:\n suppose `n` is to be...
class ExponentialNumbers(SloaneSequence): def __init__(self, a): '\n A sequence of Exponential numbers.\n\n EXAMPLES::\n\n sage: from sage.combinat.sloane_functions import ExponentialNumbers\n sage: ExponentialNumbers(0)\n Sequence of Exponential numbers aro...
class A000110(ExponentialNumbers): def __init__(self): '\n The sequence of Bell numbers.\n\n The Bell number `B_n` counts the number of ways to put\n `n` distinguishable things into indistinguishable boxes\n such that no box is empty.\n\n Let `S(n, k)` denote the Stirli...
class A000587(ExponentialNumbers): def __init__(self): '\n The sequence of Uppuluri-Carpenter numbers.\n\n The Uppuluri-Carpenter number `C_n` counts the imbalance\n in the number of ways to put `n` distinguishable things\n into an even number of indistinguishable boxes versus...
class A000100(SloaneSequence): def __init__(self): '\n INPUT:\n\n - ``n`` -- non negative integer\n\n OUTPUT:\n\n - ``integer`` -- function value\n\n EXAMPLES::\n\n sage: a = sloane.A000100;a\n Number of compositions of n in which the maximum part ...
class Sloane(SageObject): "\n A collection of Sloane generating functions.\n\n This class inspects sage.combinat.sloane_functions, accumulating\n all the SloaneSequence classes starting with 'A'. These are listed\n for tab completion, but not instantiated until requested.\n\n EXAMPLES:\n\n Ensur...
class SpechtModule(SubmoduleWithBasis): '\n A Specht module.\n\n Let `S_n` be the symmetric group on `n` letters and `R` be a commutative\n ring. The *Specht module* `S^D` for a diagram `D` is an `S_n`-module\n defined as follows. Let\n\n .. MATH::\n\n R(D) := \\sum_{w \\in R_D} w,\n ...
def _to_diagram(D): '\n Convert ``D`` to a list of cells representing a diagram.\n\n TESTS::\n\n sage: from sage.combinat.specht_module import _to_diagram\n sage: _to_diagram(Partition([3,1,1]))\n [(0, 0), (0, 1), (0, 2), (1, 0), (2, 0)]\n sage: _to_diagram(SkewPartition([[5,3,1,...
def specht_module_spanning_set(D, SGA=None): '\n Return a spanning set of the Specht module of diagram ``D``.\n\n INPUT:\n\n - ``D`` -- a list of cells ``(r,c)`` for row ``r`` and column ``c``\n - ``SGA`` -- optional; a symmetric group algebra\n\n EXAMPLES::\n\n sage: from sage.combinat.spec...
def specht_module_rank(D, base_ring=None): '\n Return the rank of the Specht module of diagram ``D``.\n\n EXAMPLES::\n\n sage: from sage.combinat.specht_module import specht_module_rank\n sage: specht_module_rank([(0,0), (1,1), (2,2)])\n 6\n ' D = _to_diagram(D) span_set = sp...
def polytabloid(T): '\n Compute the polytabloid element associated to a tableau ``T``.\n\n For a tableau `T`, the polytabloid associated to `T` is\n\n .. MATH::\n\n e_T = \\sum_{\\sigma \\in C_T} (-1)^{\\sigma} \\{\\sigma T\\},\n\n where `\\{\\}` is the row-equivalence class, i.e. a tabloid,\n ...
def tabloid_gram_matrix(la, base_ring): '\n Compute the Gram matrix of the bilinear form of a Specht module\n pulled back from the tabloid module.\n\n For the module spanned by all tabloids, we define an bilinear form\n by having the tabloids be an orthonormal basis. We then pull this\n bilinear fo...
def simple_module_rank(la, base_ring): "\n Return the rank of the simple `S_n`-module corresponding to the\n partition ``la`` of size `n` over ``base_ring``.\n\n EXAMPLES::\n\n sage: from sage.combinat.specht_module import simple_module_rank\n sage: simple_module_rank([3,2,1,1], GF(3))\n ...
class CharacteristicSpeciesStructure(GenericSpeciesStructure): def __repr__(self): '\n EXAMPLES::\n\n sage: F = species.CharacteristicSpecies(3)\n sage: a = F.structures([1, 2, 3]).random_element(); a\n {1, 2, 3}\n sage: F = species.SingletonSpecies()\n ...
class CharacteristicSpecies(GenericCombinatorialSpecies, UniqueRepresentation): def __init__(self, n, min=None, max=None, weight=None): '\n Return the characteristic species of order `n`.\n\n This species has exactly one structure on a set of size `n`\n and no structures on sets of a...
class EmptySetSpecies(CharacteristicSpecies): def __init__(self, min=None, max=None, weight=None): '\n Returns the empty set species.\n\n This species has exactly one structure on the empty set. It is\n the same (and is implemented) as ``CharacteristicSpecies(0)``.\n\n EXAMPLE...
class SingletonSpecies(CharacteristicSpecies): def __init__(self, min=None, max=None, weight=None): '\n Returns the species of singletons.\n\n This species has exactly one structure on a set of size `1`. It\n is the same (and is implemented) as ``CharacteristicSpecies(1)``.\n\n ...
class CompositionSpeciesStructure(GenericSpeciesStructure): def __init__(self, parent, labels, pi, f, gs): "\n TESTS::\n\n sage: E = species.SetSpecies(); C = species.CycleSpecies()\n sage: L = E(C)\n sage: a = L.structures(['a','b','c']).random_element() ...
class CompositionSpecies(GenericCombinatorialSpecies, UniqueRepresentation): def __init__(self, F, G, min=None, max=None, weight=None): '\n Returns the composition of two species.\n\n EXAMPLES::\n\n sage: E = species.SetSpecies()\n sage: C = species.CycleSpecies()\n ...