Package sage :: Package combinat :: Module sloane_functions
[hide private]
[frames] | no frames]

Module sloane_functions

source code


Functions that compute some of the sequences in Sloane's tables

EXAMPLES:
   Type sloane.[tab] to see a list of the sequences that are defined.
   sage: a = sloane.A000005; a
    The integer sequence tau(n), which is the number of divisors of n.
    sage: a(1)
    1
    sage: a(6)
    4
    sage: a(100)
    9

Type \code{d._eval??} to see how the function that computes an individual
term of the sequence is implemented. 

The input must be a positive integer:
    sage: a(0)
    Traceback (most recent call last):
    ...
    ValueError: input n (=0) must be a positive integer
    sage: a(1/3)
    Traceback (most recent call last):
    ...
    TypeError: input must be an int, long, or Integer

You can also change how a sequence prints:
    sage: a = sloane.A000005; a
    The integer sequence tau(n), which is the number of divisors of n.
    sage: a.rename('(..., tau(n), ...)')
    sage: a
    (..., tau(n), ...)
    sage: a.reset_name()
    sage: a
    The integer sequence tau(n), which is the number of divisors of n.

TESTS:
    sage: a = sloane.A000001;
    sage: a == loads(dumps(a))
    True

AUTHORS:
    -- William Stein: framework
    -- Jaap Spies: most sequences
    -- Nick Alexander: updated framework



Classes [hide private]
  SloaneSequence
Base class for a Slone integer sequence.
  A000001
  A000027
  A000004
  A000005
  A000009
  A000796
  A003418
  A007318
  A008275
  A008277
  A049310
  A000010
  A000007
  A005843
  A000035
  A000169
  A000272
  A000312
  A001477
  A004526
  A000326
  A002378
  A002620
  A005408
  A000012
  A000120
  A010060
  A000069
  A001969
  A000290
  A000225
  A000015
  A000016
  A000032
  A004086
  A002113
  A000030
  A000040
  A002808
  A018252
  A000043
  A000668
  A000396
  A005100
  A005101
  A002110
  A000720
  A064553
  A001055
  A006530
  A000961
  A005117
  A020639
  A000041
  A000045
  A000108
  A001006
  A000079
  A000578
  A000244
  A000302
  A000583
  A000142
  A000085
  A001189
  A000670
  A006318
  A000165
  A001147
  A006882
  A000984
  A001405
  A000292
  A000330
  ExtremesOfPermanentsSequence
  A000153
  A000255
  A000261
  A001909
  A001910
  ExtremesOfPermanentsSequence2
  A090010
  A055790
  A090012
  A090013
  A090014
  A090015
  A090016
  A000166
  A000203
  A001157
  A008683
  A000204
  A000217
  A000124
  A002275
  RecurrenceSequence
  A001110
  A051959
  A001221
  A001222
  A046660
Excess of $n$ = number of prime divisors (with multiplicity) - number of prime divisors (without multiplicity).
  A001227
  A001358
  A001694
  A001836
  RecurrenceSequence2
  A001906
  A001333
  A001045
  A000129
  A001109
  A015521
  A015523
  A015530
  A015531
  A015551
  A082411
  A083103
  A083104
  A083105
  A083216
  A061084
  A000213
  A000073
  A079922
function returns solutions to the Dancing School problem with $n$ girls and $n+3$ boys.
  A079923
function returns solutions to the Dancing School problem with $n$ girls and $n+4$ boys.
  A111774
  A111775
  A111776
  A111787
  ExponentialNumbers
  A000110
  A000587
  A000100
  Sloane
A collection of Sloane generating functions.
Functions [hide private]
 
recur_gen2b(a0, a1, a2, a3, b)
inhomogenous second-order linear recurrence generator with fixed coefficients and $b = f(n)$ $a(0) = a0$, $a(1) = a1$, $a(n) = a2*a(n-1) + a3*a(n-2) +f(n)$.
source code
 
recur_gen2(a0, a1, a2, a3)
homogenous general second-order linear recurrence generator with fixed coefficients...
source code
 
recur_gen3(a0, a1, a2, a3, a4, a5)
homogenous general third-order linear recurrence generator with fixed coefficients...
source code
 
perm_mh(m, h)
This functions calculates $f(g,h)$ from Sloane's sequences A079908-A079928 INPUT: m -- positive integer h -- non negative integer OUTPUT: permanent of the m x (m+h) matrix, etc.
source code
Variables [hide private]
  Integer = ['4ti2-20061025', 'R-2.6.0', 'atlas-3.7.37', 'atlas-...
  sloane = <class 'sage.combinat.sloane_functions.Sloane'>
Function Details [hide private]

recur_gen2b(a0, a1, a2, a3, b)

source code 

inhomogenous second-order linear recurrence generator with fixed coefficients
and $b = f(n)$

$a(0) = a0$, $a(1) = a1$, $a(n) = a2*a(n-1) + a3*a(n-2) +f(n)$.

EXAMPLES:
    sage: from sage.combinat.sloane_functions import recur_gen2b
    sage: it = recur_gen2b(1,1,1,1, lambda n: 0)
    sage: [it.next() for i in range(10)]
    [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]

recur_gen2(a0, a1, a2, a3)

source code 

homogenous general second-order linear recurrence generator with fixed coefficients

a(0) = a0, a(1) = a1, a(n) = a2*a(n-1) + a3*a(n-2)

EXAMPLES:
    sage: from sage.combinat.sloane_functions import recur_gen2
    sage: it = recur_gen2(1,1,1,1)
    sage: [it.next() for i in range(10)]
    [1, 1, 2, 3, 5, 8, 13, 21, 34, 55]

recur_gen3(a0, a1, a2, a3, a4, a5)

source code 

homogenous general third-order linear recurrence generator with fixed coefficients

a(0) = a0, a(1) = a1, a(2) = a2, a(n) = a3*a(n-1) + a4*a(n-2) + a5*a(n-3)

EXAMPLES:
    sage: from sage.combinat.sloane_functions import recur_gen3
    sage: it = recur_gen3(1,1,1,1,1,1)
    sage: [it.next() for i in range(10)]
    [1, 1, 1, 3, 5, 9, 17, 31, 57, 105]

perm_mh(m, h)

source code 

This functions calculates $f(g,h)$ from Sloane's sequences A079908-A079928

INPUT:
    m -- positive integer
    h -- non negative integer

OUTPUT:
    permanent of the m x (m+h) matrix, etc.

EXAMPLES:
    sage: from sage.combinat.sloane_functions import perm_mh
    sage: perm_mh(3,3)
    36
    sage: perm_mh(3,4)
    76

AUTHOR: Jaap Spies (2006)


Variables Details [hide private]

Integer

Value:
['4ti2-20061025',
 'R-2.6.0',
 'atlas-3.7.37',
 'atlas-3.8.1',
 'atlas-3.8.1.p1',
 'atlas-3.8.1.p3',
 'atlas-3.8.p11',
 'atlas-3.8.p6',
...