# Library

IntegerSequences.AltPolyFunction

Return the polynomial $p$ with the coefficients C and alternating signs (i.e. with $(-1)^k c[k] x^k)$.

AltPoly(C)

source

Return the polynomial $p$ with alternating signs attached to the coefficients .

AltPoly(p)

source
IntegerSequences.BellNumberFunction

Return the n-th Bell number. Bell numbers count the ways to partition a set of $n$ labeled elements.

julia> BellNumber(10)
115975
BellNumber(n)

source
IntegerSequences.BellTransFunction

The Bell transform transforms an integer sequence into an integer triangle; also known as incomplete Bell polynomials. Let $X$ be an integer sequence, then

$B_{n,k}(X) = \sum_{m=1}^{n-k+1} \binomial{n-1}{m-1} X[m] B_{n-m,k-1}(X)$

where $B_{0,0} = 1, B_{n,0} = 0$ for $n≥1, B_{0,k} = 0$ for $k≥1$.

BellTrans(n, k, X)

source

The Bell transform transforms an integer sequence into an integer triangle; also known as incomplete Bell polynomials. Let $F$ be an integer sequence generating function, then

$B_{n,k}(F) = \sum_{m=1}^{n-k+1} \binomial{n-1}{m-1} F(m) B_{n-m,k-1}(F)$

where $B_{0,0} = 1, B_{n,0} = 0$ for $n≥1, B_{0,k} = 0$ for $k≥1$.

BellTrans(n, k, F)

source
IntegerSequences.BellTriangleFunction

The Bell triangle gathers the results of the Bell transform applied to the initial segments of the input sequence.

Famously the sequence (1,1,1,...) is mapped to the triangle of the Stirling set numbers.

julia> ShowAsΔ(BellTriangle(5, k -> 1))
1
0 1
0 1 1
0 1 3 1
0 1 7 6 1
BellTriangle(n, seq)

source
IntegerSequences.BinDigitsFunction

Return the binary expansions of nonnegative $n$ and $k$. If algo=max then pad the resulting int arrays with 0 to make them equally long. For example

BinDigits(12, 17, max) = ([0, 0, 1, 1, 0], [1, 0, 0, 0, 1]).

If algo=min then the arrays are truncated to the length of the smaller operand.

BinDigits(12, 17, min) = ([0, 0, 1, 1], [1, 0, 0, 0]).

These are the lists which are itemwise compared by the logical operators.

BinDigits(n, k)
BinDigits(n, k, algo)

source
IntegerSequences.BinomialFunction

Return the extended binomial coefficients defined for all $n ∈ Z$ and $k ∈ Z$. Behaves like the binomial function in Maple and Mathematica.

$\binom{n}{k} = \lim \limits_{x \rightarrow 1}(Γ(n + x) / (Γ(k + x) Γ(n - k + x))).$

Binomial(n, k)

source
IntegerSequences.BitsFunction

Return the bitwise boolean operation represented by $op$ applied to the binary expansions of the integers $n$ and $k$. $op$ is an integer $0 <= op < 16$ encoding the result of the operation in terms of the truth table.

Bits(op, n, k)
Bits(op, n, k, algo)

source

Return the bitwise boolean operation represented by $op$ applied to the binary expansions of the integers $n$ and $k$. $op$ is an acronym as given in the list 'BoolOps'.

Bits(op, n, k)
Bits(op, n, k, algo)

source
IntegerSequences.CalkinWilfTreeFunction

Alias for the (much better named) EuclidTree. See Malter, Schleicher, Zagier, New looks at old number theory, Amer. Math. Monthly, 120(3), 2013, pp. 243-264.

CalkinWilfTree(n)

source
IntegerSequences.CantorBoustrophedonicEnumerationFunction

The boustrophedonic Cantor enumeration of ℕ X ℕ where $ℕ = {0, 1, 2, ...}$. If $(x, y)$ and $(x', y')$ are adjacent points on the trajectory of the map then max$(|x - x'|, |y - y'|)$ is always 1 whereas for the Cantor enumeration this quantity can become arbitrarily large. In this sense the boustrophedonic variant is continuous whereas Cantor's realization is not.

CantorBoustrophedonicEnumeration(len)

source
IntegerSequences.CantorBoustrophedonicPairingFunction

The inverse function of the boustrophedonic Cantor enumeration (the pairing function), computes n for given $(x, y)$ and returns $(x + y)(x + y + 1)/2 + m$ where $m = |x - y| - (x > y ? 1 : 0)$.

CantorBoustrophedonicPairing(x, y)

source
IntegerSequences.CantorEnumerationFunction

The Cantor enumeration of ℕ X ℕ where ℕ $= {0, 1, 2, ...}$. If $(x, y)$ and $(x', y')$ are adjacent points on the trajectory of the map then max$(|x - x'|, |y - y'|)$ can become arbitrarily large. In this sense Cantor's enumeration is not continous.

CantorEnumeration(len)

source
IntegerSequences.CantorPairingFunction

The inverse function of the Cantor enumeration (the pairing function), computes n for given $(x, y)$ and returns $(x + y)(x + y + 1)/2 + p$ where $p = x$ if $x - y$ is odd and $y$ otherwise.

CantorPairing(x, y)

source
IntegerSequences.CoeffAltSumFunction

Return the alternating sum of the coefficients of the polynomial $p$.

CoeffAltSum(p)

source

Return the sequence of the alternating sums of the coefficients of the sequence of polynomials $P$.

CoeffAltSum(P, len)

source
IntegerSequences.CoeffConstFunction

Return the constant coefficient of the polynomial $p$.

CoeffConst(p)

source

Return the sequence of the constant coefficients of the sequence of polynomials $P$.

CoeffConst(P, len)

source
IntegerSequences.CoeffSumFunction

Return the sum of the coefficients of the polynomial $p$.

CoeffSum(p)

source

Return the sequence of the sum of coefficients of the sequence of polynomials $P$.

CoeffSum(P, len)

source
IntegerSequences.CoeffsFunction

Return the coefficients of the polynomial $p$.

Coeffs(p)

source

Return the list of the coefficients of the first $len$ polynomials of the sequence of polynomials $P$ as a triangle.

Coeffs(P, len)

source
IntegerSequences.CombinationsFunction

Generate all Combinations of $n$ elements from an indexable object $a$. Because the number of Combinations can be very large, this function returns an iterator object. Use collect(Combinations(a, n)) to get an array of all Combinations.

Combinations(a, t)

source

Generate Combinations of the elements of $a$ of all orders. Chaining of order iterators is eager, but the sequence at each order is lazy.

Combinations(a)

source
IntegerSequences.CountFunction

Return the numbers of integers in the range 0:n which are isA.

julia> Count(8, isPrime)
4
Count(n, isAb)

source

Return the numbers of integers in the range a:b which are isA.

julia> Count(3:8, isPrime)
3
Count(r, isAb)

source
IntegerSequences.DedekindEtaPowersFunction

Compute the $q$-expansion to length len of the Dedekind $η$ function (without the leading factor $q^{1/24}$) raised to the power $r$, i.e. ${(q^{-1/24} η(q))^r = ∏_{k ≥ 1} (1 - q^k)^r.}$ In particular, $r = -1$ returns the generating function of the Partition function $p(k)$ and $r = 24$ gives the Ramanujan tau function $τ(k)$.

DedekindEtaPowers(len, r)

source
IntegerSequences.EgfPolyFunction

Return the polynomial $p$ with the coefficients C used in the form $c[k] x^k/k!$. Note that integer division is used.

EgfPoly(C)

source

Return the polynomial $p$ with coefficients in exponential form (i.e. with $c[k] x^k/k!$).

EgfPoly(p)

source
IntegerSequences.EuclidTreeFunction
julia> for n ∈ 1:4 Println(EuclidTree(n)) end
[1//1]
[1//2, 2//1]
[1//3, 3//2, 2//3, 3//1]
[1//4, 4//3, 3//5, 5//2, 2//5, 5//3, 3//4, 4//1]
EuclidTree(n)

source
IntegerSequences.F!Function

Return the number of permutations of n letters, $n! = ∏(1, n)$, the factorial of $n$. (The notation is a shortcut breaking Julia conventions.)

F!(n)

source
IntegerSequences.GaussFactorialFunction

Return $∏_{1 ≤ j ≤ N, j ⊥ n} j$, the product of the positive integers which are $≤ N$ and are prime to $n$.

GaussFactorial(N, n)

source

Return $∏_{1 ≤ j ≤ n, j ⊥ n} j$, the product of the positive integers which are $≤ n$ and are prime to $n$.

GaussFactorial(n)

source
IntegerSequences.IntegerPartitionsFunction

Return an iterator over all partitions of $n$. List the parts of the partitions according to the $PartitionOrder$ given as second parameter. By default the partition order is 'byNumPart'.

IntegerPartitions(n)
IntegerPartitions(n, o)

source

Return an iterator over all weakly descending lists with $m$ integers that sum to $n$. List the parts of the partitions of $n$ in graded colexicographic order.

IntegerPartitions(n, m)

source
IntegerSequences.InvOrthoPolyFunction

Return the inverse of the coefficients of the orthogonal polynomials generated by $s$ and $t$ as a triangular array with dim rows.

InvOrthoPoly(dim, s, t)

source
IntegerSequences.JacobiTheta3PowersFunction

The $q$-expansion to length len of the Jacobi theta function raised to the power $r$, i.e. $ϑ(q)^r$ where $ϑ(q) = 1 + ∑_{k ≥ 1} q^{k^2}$. Number of ways of writing $n$ as a sum of $r$ squares.

JacobiTheta3Powers(len, r)

source
IntegerSequences.JacobiTheta4PowersFunction

Return the $q$-expansion to length $len$ of the Jacobi theta function raised to the power $r$, i.e. $ϑ(-q)^r$ where $ϑ(q) = 1 + ∑_{k ≥ 1} q^{k^2} .$

JacobiTheta4Powers(len, r)

source
IntegerSequences.LahFunction

Return the $n$-th row of the Lah number triangle.

Lah(n)

source

Return the $k$-th term of the $n$-th row of the Lah number triangle.

Lah(n, k)

source
IntegerSequences.ModuleAbundantConstant

$n$ is an abundant number if $σ(n) > 2n$. An abundant number is a number for which the sum of its proper divisors is greater than the number itself.

• isAbundant, is005101, I005101, F005101, L005101, V005101.
source
IntegerSequences.ModuleAndreNumbersConstant

Generalized André numbers count the $m$-alternating permutations of length $n$, cf. A181937.

[  SEQ  ] n|k [0][1][2][3][4] [5] [6]  [7]   [8]   [9]  [10]
[V000012] [1]  1, 1, 1, 1, 1,  1,  1,   1,    1,    1,     1
[V000111] [2]  1, 1, 1, 2, 5, 16, 61, 272, 1385, 7936, 50521
[V178963] [3]  1, 1, 1, 1, 3,  9, 19,  99,  477, 1513, 11259
[V178964] [4]  1, 1, 1, 1, 1,  4, 14,  34,   69,  496,  2896
[V181936] [5]  1, 1, 1, 1, 1,  1,  5,  20,   55,  125,   251
[V250283] [6]  1, 1, 1, 1, 1,  1,  1,   6,   27,   83,   209
• André, C000111, V000111, V178963, V178964, V181936, V250283.
source
IntegerSequences.ModuleBellNumbersConstant

The Bell transform transforms an integer sequence into an integer triangle; also known as incomplete Bell polynomials. Let $X$ be an integer sequence, then

$B_{n, k}(X) = \sum_{m=1}^{n-k+1} \binomial{n-1}{m-1} X[m] B_{n-m,k-1}(X)$

where $B_{0,0} = 1, B_{n,0} = 0$ for $n≥1, B_{0,k} = 0$ for $k≥1$.

The Bell transform is (0,0)-based and the associated triangle always has as first column 1,0,0,0,... This column is often missing in the OEIS. Other Stirling number related sequences are implemented in the module StirlingLahNumbers.

• BellTrans, BellTriangle, BellNumberList, BellNumber
• V000110, L000110, T137452, T264428, T137513, T104556, T001497, T132062, T039683, T203412, T004747, T051141, T265606, T119274, T000369, T051142
source
IntegerSequences.ModuleBernoulliNumbersConstant

We are primarily concerned with the integer Bernoulli numbers.

Cf. $A000182 (m=2), A293951 (m=3), A273352 (m=4), A318258 (m=5).$

[1] [0, 1,    0,       0,             0,                  0]
[2] [0, 1,   -2,      16,          -272,               7936]
[3] [0, 1,   -9,     477,        -74601,           25740261]
[4] [0, 1,  -34,   11056,     -14873104,        56814228736]
[5] [0, 1, -125,  249250,   -2886735625,    122209131374375]
[6] [0, 1, -461, 5699149, -574688719793, 272692888959243481]

The rational Bernoulli numbers are defined here with $B(1) = 1/2$. Why this is preferred over $B(1) = -1/2$ is explained in the Bernoulli Manifesto.

• BernoulliInt, BernoulliIntList, Bernoulli, BernoulliList
• V195441, V065619, V281586, V281588, V027641, L065619
source
IntegerSequences.ModuleBinaryQFConstant

A binary quadratic form over Z is a quadratic homogeneous polynomial in two variables with integer coefficients, $q(x, y) = ax^2 + bxy + cy^2$.

A quadratic form $q(x, y)$ represents an integer $n$ if there exist integers $x$ and $y$ with $q(x, y) = n$. We say that $q$ primitively represents $n$ if there exist relatively prime integers $x$ and $y$ such that $q(x, y) = n$.

Ported from BinaryQuadraticForms where you can find much more information on this subject.

• L002476, L008784, L031363, L034017, L035251, L038872, L038873, L042965, L057126, L057127, L068228, L084916, L089270, L141158, L242660, L243655, L244779, L244780, L244819, L243168, L244291, L007522
source
IntegerSequences.ModuleCantorMachinesConstant
• Cantor-Machine, Cantor-Enumeration, Cantor-Pairing, Cantor-BoustrophedonicMachine, Cantor-BoustrophedonicEnumeration, Cantor-BoustrophedonicPairing, RosenbergStrong-BoustrophedonicMachine, RosenbergStrong-BoustrophedonicEnumeration, RosenbergStrong-BoustrophedonicPairing
source
IntegerSequences.ModuleCountsConstant
• PreviousPrime, NextPrime, PrimePiList, takeFirst, Nth, Count, List, HilbertHotel
• L000961, L002808, L005117, L013928, L025528, L065515, L065855, L069637, L246547, L246655, L000720, V007917, V151800, V257993
source
IntegerSequences.ModuleCyclotomicBinaryFormsConstant

E. Fouvry, C. Levesque, M. Waldschmidt, Representation of integers by cyclotomic binary forms, arXiv:1712.09019 [math.NT], 2017.

• is206864, F206864, I206864, L206864, is206942, F206942, I206942, L206942, is293654, F293654, I293654, L293654, is296095, F296095, I296095, L296095, V299214, L299214, is299498, F299498, I299498, L299498, is299733, L299733, is299928, F299928, I299928, L299928, is299929, F299929, I299929, L299929, is299930, F299930, I299930, L299930, is325143, F325143, I325143, L325143, is325145, F325145, I325145, L325145
source
IntegerSequences.ModuleDelehamDeltaConstant

Philippe Deléham’s Δ-operation maps, similar to the Riordan product, two integer sequences on a lower triangular matrix. It effectively computes a continued fraction depending on the two input sequences!

Applying Deléham's Δ-operation often gives an additional first column or an additional main diagonal in the resulting triangle compared to what is listed in the OEIS.

Introduction to the Riordan Square

• DeléhamΔ, T084938, T060693, T106566, T094665, T090238, T225478, T055883, T184962, T088969, T090981, T011117
source
IntegerSequences.ModuleFigurativeNumbersConstant
• PolygonalNumber, PyramidalNumber, V014107, V095794, V067998, V080956, V001477, V000217, V000290, V000326, V000384, V000566, V000567, V001106, V001107, V005564, V058373, V254749, V000292, V000330, V002411, V002412, V002413, V002414, V007584, V007585
source
IntegerSequences.ModuleGaussFactorialsConstant

The Gauß factorial is $∏_{1 ≤ j ≤ N, j ⊥ n} j$, the product of the positive integers which are $≤ N$ and are prime to $n$.

• GaussFactorial, I193338, F193338, L193338, V193338, I193339, F193339, L193339, V193339, V216919, V001783, V055634, V232980, V232981, V232982, V124441, V124442, V066570
source
IntegerSequences.ModuleGeneralizedFibonacciConstant
• The classical Fibonacci numbers are exported from the module Fibonacci. See I000045, F000045, L000045, V000045, R000045 and is000045.

• Fibonacci(n) is defined as the number of compositions of n with no part equal to 1. They are the special case Fibonacci(n) = Multinacci(2, n).

[m
] 0  1  2   3   4   5    6    7     8     9    10    11
----------------------------------------------------------------
[0]   1, 0, 0,  0,  0,  0,   0,   0,    0,    0,    0,    0, ...
[1]   1, 1, 1,  1,  1,  1,   1,   1,    1,    1,    1,    1, ...
[2]   1, 1, 2,  3,  5,  8,  13,  21,   34,   55,   89,  144, ...
[3]   1, 1, 3,  4,  9, 14,  28,  47,   89,  155,  286,  507, ...
[4]   1, 1, 4,  5, 14, 20,  48,  75,  165,  274,  571,  988, ...
[5]   1, 1, 5,  6, 20, 27,  75, 110,  275,  429, 1001, 1637, ...
[6]   1, 1, 6,  7, 27, 35, 110, 154,  429,  637, 1638, 2548, ...
• Multinacci, V309896, V006053, V188021, V231181
source
IntegerSequences.ModuleIntPartitionsConstant

All integer partitions are listed by two orderings: IntegerPartitions(n, byNumPart) IntegerPartitions(n, byMaxPart)

Or restricted to partitions of length m: IntegerPartitions(n, m)

The partition coefficients, which are the multinomial coefficients applied to partitions, are given in both orderings (L036038, L078760).

The partition numbers and the number of partitions of n into k parts are given as PartitionNumber(n) and PartitionNumber(n, k), (V000041, L072233).

The sum of all partition coefficients of n is efficiently computed with L005651.

• V000041, V088887, I072233, L072233, L036038, L078760, L005651, L262071, L292222, L115621, L328917
source
IntegerSequences.ModuleJacobiThetaConstant

The $q$-expansion of the Jacobi theta functions 3 and 4 raised to the power $r$ is computed for various values of $r$.

• JacobiTheta3Powers, JacobiTheta4Powers, L000122, L002448, L004018, L104794, L005875, L213384, L000118, L035016, L008452, L096727, L000132, L000141, L008451, L000143, L000144, L008453, L000145, L276285, L276286, L276287, L004402, L004406, L004407, L015128, L004403, L001934, L004404, L004405, L004408, L004409, L004410, L004411, L004412, L004413, L004414, L004420, L004421, L004415, L004416, L004417, L004418, L004419, L004422, L004423, L004424, L004425
source
IntegerSequences.ModuleNumberTheoryConstant
• τ, σ, σ2, ϕ, ω, Ω, ⊥, ⍊
• Divisors, PrimeDivisors, Factors, Radical, mods, Divides, isPrime, isCyclic, isStrongCyclic, isOdd, PrimeList, isPrimeTo, isStrongPrimeTo, isNonnegative, isPositive, isEven, isSquare, isComposite, isSquareFree, isPrimePower, isPowerOfPrimes, isPerfectPower
• V000005, V000010, V000203, V001222, V001221, V008683, V181830, V034444, I003277, L003277, V061142, V034386, V002110, I050384, L050384, V001157
source
IntegerSequences.ModuleOrthoPolynomialsConstant
• OrthoPoly, InvOrthoPoly, T053121, T216916, T217537, T064189, T202327, T111062, T099174, T066325, T049310, T137338, T104562, T037027, T049218, T159834, T137286, T053120, T053117, T111593, T059419, L217924, L005773, L108624, L005425, L000085, L001464, L003723, L006229
source
IntegerSequences.ModulePolynomialsConstant

Mostly convenient functions to deal with polynomials as often used in connection with ordinary and exponential generating functions. The naming scheme used is roughly described by:

   Poly       <-> Coeffs
AltPoly    <-> Poly(AltCoeffs)
EgfPoly    <-> Poly(EgfCoeffs)
OgfPoly    <-> Poly(OgfCoeffs)
AltEgfPoly <-> Poly(AltEgfCoeffs)

Here 'Alt' stands for alternating, 'Egf' for exponential generating function, 'Ogf' for ordinary generating function.

• Coeffs, CoeffSum, CoeffAltSum, CoeffConst, CoeffLeading, AltCoeffs, Diagonal, Central, EgfCoeffs, AltEgfCoeffs, Poly, AltPoly, EgfPoly, AltEgfPoly, ReflectPoly.
source
IntegerSequences.ModuleProductsConstant
• ∏, Product, F!, RisingFactorial, ↑, FallingFactorial, ↓, MultiFactorial
• V000407, V124320, V265609, V000142, V081125, V001147, V000165, V032031, V007559, V008544, V007696, V001813, V008545, V047053
source
IntegerSequences.ModuleRationalTreesConstant

Rational trees as understood here are binary trees enumerating the positive or nonnegative rational numbers. Examples are the Euclid tree, the Kepler tree and the Stern-Brocot tree (a.k.a. Farey tree). They are closely related to binary partitions and to Stern's diatomic sequence or Dijkstra's fusc function.

Malter, Schleicher, Zagier, New looks at old number theory, Amer. Math. Monthly, 120(3), 2013, pp. 243-264.

• EuclidTree, CalkinWilfTree, SchinzelSierpinskiEncoding
source
IntegerSequences.ModuleRiordanSquaresConstant

The Riordan product is a map a, b ↦ [a, b] associating two formal power series a, b with a lower triangular matrix [a, b]. The Riordan square is the case a = b of the Riordan product. Formally we can describe the Riordan square as a transform RS: Z[[x]] ↦ Mat[Z] which maps power series over the integers to (lower triangular) integer matrices.

• RiordanProduct, RiordanSquare
• T039599, T116392, T172094, T321620, T321621, T321623, T321624, T322942

Introduction to the Riordan Square

source
IntegerSequences.ModuleSelfConvolutiveConstant

Some exactly solvable self-convolutive recurrences.

• SelfConvRec, L000698, L001710, L003319, L005411, L005412, L006012, L006318, L047891, L062980, L082298, L082301, L082302, L105523, L107716, L111529, L111530, L111531, L111532, L111533, L146559, L167872
source
IntegerSequences.ModuleSeriesExpansionConstant

The generating functions of various combinatorial and number-theoretic functions.

• Coefficients, EgfExpansion, G000045, G000257, L000257, G000032, L000032, G000073, L000073, G000108, L000108, G000957, L000957, G001003, L001003, G001006, L001006, G001045, L001045, G002426, L002426, G005043, L005043, G006318, G068875, L068875
source
IntegerSequences.ModuleSetPartitionsConstant
• SetPartitions(s::AbstractVector)

Return an iterator over all set partitions of the elements of the array $s$, represented as arrays of arrays.

• SetPartitions(n::Int)

Return an iterator over all set partitions of the elements of the array $[1,2,...,n]$, represented as arrays of arrays.

• SetPartitions(s::AbstractVector, m::Int)

Return all set partitions of the elements of the array $s$ into exactly $m$ subsets, represented as arrays of arrays.

• SetPartitions(n::Int, m::Int)

Return all set partitions of the elements of the array ${1,2,3,...,n}$ into exactly $m$ subsets, represented as arrays of arrays.

• SetNumber(n::Int)

Return the numbers of partitions of an $n$-set into nonempty subsets.

• SetNumber(n::Int, m::Int)

Return the numbers of partitions of an $n$-set into $m$ nonempty subsets.

source
IntegerSequences.ModuleSwingFactorialConstant

Basic implementation of the swing algorithm using no primes. Claims to be the most efficient simple algorithm to compute the factorial. An advanced version based on prime-factorization is available as the prime-swing factorial factorialPS.

• Sfactorial
source
IntegerSequences.ModuleVisitPartitionsConstant

Two alternative implementations of integer partitions. The first one implements the 'visit-pattern' in Fortran style. Compared to the implementation in JuliaMath/Combinatorics:

For n = 50 the benchmark shows:

• 0.141849 seconds ( 9 allocations: 1.672 KiB) [NEXPAR]
• 0.111040 seconds (408.45 k allocations: 40.882 MiB, 21.10% gc time) [JuliaMath]

For n = 100 the benchmark shows:

• 167.598273 seconds ( 15 allocations: 4.813 KiB) [NEXPAR]
• 86.960344 seconds (381.14 M allocations: 48.735 GiB, 11.29% gc time) [JuliaMath]

Our function is slower but the Combinatorics function takes vastly more space.

In the second alternative implementation the representation of the partitions for fixed n is a weakly increasing lists ordered lexicographicaly. It has a nice algorithm implemented directly (i.e. without iteration).

• Partition, V080577, V026791
source
IntegerSequences.NthFunction

Return the Nth integer which is isA. (For N ≤ 0 return 0.)

julia> Nth(7, isPrime)
17
Nth(N, isA)

source
IntegerSequences.OrthoPolyFunction

By the theorem of Favard an orthogonal polynomial systems $p_{n}(x)$ is a sequence of real polynomials with deg$(p_{n}(x)) = n$ for all $n$ if and only if

$p_{n+1}(x) = (x - s_n)p_n(x) - t_n p_{n-1}(x)$

with $p_{0}(x)=1$ for some pair of seq's $s_k$ and $t_k$. Return the coefficients of the polynomials as a triangular array with dim rows.

OrthoPoly(dim, s, t)

source
IntegerSequences.PSfactorialFunction

Return the factorial $n! = 1×2× ... ×n$, which is the order of the symmetric group S_n or the number of permutations of n letters (cf. A000142).

PSfactorial(n)

source
IntegerSequences.PartOrderType

Conventional names for orderings of integer partitions of $n$. byMaxPart means first order by the biggest part. byNumPart means first order by the number of parts. The secondary order is in both cases colexicographic.

source
IntegerSequences.PartitionNumberFunction

Return the number of partitions of $n$ into $k$ parts. Cf. A072233.

PartitionNumber(n, k)

source

Return the number of partitions of $n$. Cf. A000041.

PartitionNumber(n)

source
IntegerSequences.PiFunction

Return the decimal expansion of π up to $n$ digits as a string. Note the feature that the precision is increased only in steps of 4, i.e. only if $n$ is divisible by 4. If $n$ is not divisible by 4 then the number of digits in the output is rounded down to the largest number divisible by 4 smaller than $n$.

julia> Pi(8)
31415926
julia> Pi(10)
31415926
julia> Pi(12)
314159265358
Pi(digits)

source
IntegerSequences.PrimePiListFunction

Return the list of number of primes $≤ n$ for $n ≥ 0$.

julia> PrimePiList(8)

[0, 0, 1, 2, 2, 3, 3, 4]
PrimePiList(len)

source
IntegerSequences.PrimeSieveFunction

Return the prime sieve, as a BitArray, of the positive integers (from lo, if specified) up to hi. Useful when working with either primes or composite numbers.

PrimeSieve(lo, hi)

source
IntegerSequences.ProductFunction

If $a ≤ b$ then return the product of $i$$a:b else return 1. Product(a, b)  source Return the accumulated product of an array. Product(A)  source IntegerSequences.RadicalFunction Return the radical of n which is the product of the prime numbers dividing n (also called the squarefree kernel of n). Radical(n)  source IntegerSequences.RecTriangleType A recursive triangle RecTriangle is a subtype of AbstractTriangle. The rows of the triangle are generated by a function gen(n, k, prevrow) defined for n ≥ 0 and 0 ≤ k ≤ n. The function returns value of type fmpz. The parameter prevrow is a function which returns the values of row(n-1) of the triangle and 0 if k < 0 or k > n. The function prevrow is provided by an instance of RecTriangle and must not be defined by the user. source IntegerSequences.RosenbergStrongBoustrophedonicEnumerationFunction The boustrophedonic Rosenberg-Strong enumeration of ℕ X ℕ where ℕ = {0, 1, 2, ...}. If (x, y) and (x', y') are adjacent points on the trajectory of the map then max(|x - x'|, |y - y'|) is always 1 whereas the Rosenberg-Strong realization is not. RosenbergStrongBoustrophedonicEnumeration(len)  source IntegerSequences.RowFunction Return row n (0 ≤ n) of the lower triangular matrix T or the row n in reversed order if reversed is set true. Row(T, n) Row(T, n, reversed)  source IntegerSequences.RowSumsFunction Return the row sums of a triangle, if alternate=true then the alternating row sums. RowSums(T) RowSums(T, alternate)  source IntegerSequences.SchinzelSierpinskiEncodingFunction Return the Schinzel-Sierpinski encoding of the positive rational number r. julia> for n ∈ 1:4 println([SchinzelSierpinski(l) for l ∈ EuclidTree(n)]) end [1//1] [2//5, 5//2] [3//11, 5//3, 3//5, 11//3] [2//11, 3//2, 11//19, 19//7, 7//19, 19//11, 2//3, 11//2] SchinzelSierpinskiEncoding(l) SchinzelSierpinskiEncoding(l, searchLimit)  source IntegerSequences.SeqShowFunction Print the array A in the format n ↦ A[n] for n in the given range. SeqShow(A, R) SeqShow(A, R, offset)  source Print the array A in the format n ↦ A[n] for n in the range first:last. SeqShow(A, first, last)  source Print the array A in the format n ↦ A[n]. SeqShow(A) SeqShow(A, offset)  source IntegerSequences.SeqTestFunction Perform tests for an array of sequences of given type assuming the given offset. SeqTest(seqarray, kind) SeqTest(seqarray, kind, offset)  source IntegerSequences.SetNumberFunction Return the numbers of partitions of an n-set into m nonempty subsets. SetNumber(n, m)  source Return the numbers of partitions of an n-set into nonempty subsets. SetNumber(n)  source IntegerSequences.SetPartitionsFunction Return an iterator over all set partitions of the elements of an array s, represented as arrays of arrays. SetPartitions(s)  source Return an iterator over all set partitions of the elements of the array [1,2,...,n], represented as arrays of arrays. SetPartitions(n)  source Return all set partitions of the elements of an array s into exactly m subsets, represented as arrays of arrays. SetPartitions(s, m)  source Return all set partitions of the elements of the array {1,2,3,...,n} into exactly m subsets, represented as arrays of arrays. SetPartitions(n, m)  source IntegerSequences.SfactorialFunction Return the factorial of n. Basic implementation of the swing algorithm using no primes. An advanced version based on prime-factorization is available as the prime-swing factorial factorialPS. Sfactorial(n)  source IntegerSequences.ShowAsΔFunction Display a lower triangular matrix. ShowAsΔ(T) ShowAsΔ(T, separator)  source Display an array as a lower triangular matrix. ShowAsΔ(T) ShowAsΔ(T, separator)  source IntegerSequences.UlamListFunction Return a list of Ulam numbers. An Ulam number u(n) is the least number > u(n-1) which is a unique sum of two distinct earlier terms; u(1) = 1 and u(2) = 2. UlamList(len)  source IntegerSequences.ZArrayFunction Return an array of type fmpz of length n preset with 0. ZArray(len)  source Return an array of type fmpz and of size n filled by the values of the function f in the range offset:n. ZArray(n, f) ZArray(n, f, offset)  source IntegerSequences.isZumkellerFunction Is n a Zumkeller number? A Zumkeller number n is an integer whose divisors can be partitioned into two disjoint sets whose sums are both σ(n)/2. isZumkeller(n)  source IntegerSequences.modsFunction Return the least absolute remainder. mods uses the symmetric representation for integers modulo m, i.e. remainders will be reduced to integers in the range [-div(|m| - 1, 2),div(|m|, 2)]. mods(b, a)  source IntegerSequences.oeis_localFunction Get the sequence with A-number 'anum' from a local copy of the expanded 'stripped.gz' file which can be downloaded from the OEIS. 'bound' is an upper bound for the number of terms returned. The 'stripped' file is assumed to be in the '../data' directory. oeis_local(anum, bound)  source IntegerSequences.oeis_remoteFunction Download the sequence with A-number 'anum' from the OEIS to a file in json format. The file is saved in the 'data' directory. oeis_remote(anum)  source IntegerSequences.oeis_searchFunction Search for a sequence in the local OEIS database ('../data/stripped'). Input the sequence as a comma separated string. The search is redone 'restarts' times in the case that no match was found with the first remaining term removed from the search string. Prints the matches. oeis_search(seq, restarts) oeis_search(seq, restarts, verbose)  source Search for a sequence in the local OEIS database starting from the second term. oeis_search(seq, restarts) oeis_search(seq, restarts, verbose)  source IntegerSequences.:↑Function Return the rising factorial which is the product of i$$n:(n + k - 1)$. A convenient infix syntax for the rising factorial is n ↑ k.

↑(n, k)

source
IntegerSequences.:↓Function

Return the falling factorial which is the product of $i$$(n - k + 1):n. A convenient infix syntax for the falling factorial is n ↓ k. ↓(n, k)  source IntegerSequences.∏Function If a ≤ b then return the product of i$$a:b$ else return $1$.

∏(a, b)

source

Return the accumulated product of an array.

∏(A)

source
IntegerSequences.⊥Function

Query if $m$ is prime to $n$. Knuth, Graham and Patashnik write in "Concrete Mathematics": "Hear us, O mathematicians of the world! Let us not wait any longer! We can make many formulas clearer by defining a new notation now! Let us agree to write m ⊥ n, and to say "m is prime to n", if m and n are relatively prime."

⊥(m, n)

source
IntegerSequences.⍊Function

Query if $m$ is strong prime to $n$. $m$ is strong prime to $n$ iff $m$ is prime to $n$ and $m$ does not divide $n-1$.

⍊(m, n)

source
IntegerSequences.C000002Function

Generate the Kolakoski sequence which is the unique sequence over the alphabet ${1, 2}$ starting with $1$ and having the sequence of run lengths identical with itself.

C000002()

source
IntegerSequences.L000110Function

Return a list of Bell numbers of length len.

julia> L000110(10)
[1, 1, 2, 5, 15, 52, 203, 877, 4140, 21147]
L000110(len)

source
IntegerSequences.V000255Function

Return $(n+1)!$ Hypergeometric1F1$[-n, -n-1, -1]$. Number of fixedpoint-free permutations beginning with 2. (L. Euler).

V000255(n)

source
IntegerSequences.V000262Function

Return $n!$ Hypergeometric1F1$[1-n, 2, -1]$. Number of partitions of ${1,...,n}$ into any number of ordered subsets.

V000262(n)

source
IntegerSequences.T000369Function

Return the Bell transform of the MultiFactorial numbers of type (4,3).

julia> ShowAsΔ(T000369(5))
1
0 1
0 3 1
0 21 9 1
0 231 111 18 1
T000369(n)

source
IntegerSequences.L000720Function

Return the list of number of primes $≤ n$ for $n ≥ 0$.

julia> L000720(8)

[0, 0, 1, 2, 2, 3, 3, 4]
L000720(len)

source
IntegerSequences.V000796Function

Return the decimal expansion of π up to $n$ digits as a string. (Note what the docstring of 'Pi'' says about the number of digits in the output.)

V000796(digits)

source
IntegerSequences.L000961Function

Return a list of powers of primes of length len. (Numbers of the form $p^k$ where $p$ is a prime and $k ≥ 0$.)

julia> L000961(8)
[1, 2, 3, 4, 5, 7, 8, 9]
L000961(len)

source
IntegerSequences.V001316Function

Return 2^BitCount(n). Should be called Glaisher's sequence since James Glaisher showed that odd binomial coefficients are counted by this sequence.

V001316(n)

source
IntegerSequences.V001339Function

Return $(n+1)!$ Hypergeometric1F1$[-n, -n-1, 1]$. Number of arrangements of ${1, 2, ..., n+1}$ containing the element 1.

V001339(n)

source
IntegerSequences.V001783Function

Return $∏_{1 ≤ j ≤ n, j ⊥ n} j$, the product of the positive integers which are $≤ N$ and are prime to $n$, a.k.a. the phi-torial of n.

V001783(n)

source
IntegerSequences.L002808Function

Return a list of composite numbers of length len. (Numbers which have more than one prime divisor.)

julia> L002808(8)
[4, 6, 8, 9, 10, 12, 14, 15]
L002808(len)

source
IntegerSequences.T004747Function

Return the Bell transform of the MultiFactorial numbers of type (3,2).

julia> ShowAsΔ(T004747(5))
1
0 1
0 2 1
0 10 6 1
0 80 52 12 1
T004747(n)

source
IntegerSequences.L005117Function

Return a list of squarefree numbers of length len. (Numbers which are not divisible by a square greater than 1.)

julia> L005117(8)
[1, 2, 3, 5, 6, 7, 10, 11]
L005117(len)

source
IntegerSequences.L005411Function

Return the number of non-vanishing Feynman diagrams of order $2n$ for the electron or the photon propagators in quantum electrodynamics.

L005411(len)

source
IntegerSequences.L005412Function

Return the number of non-vanishing Feynman diagrams of order $2n$ for the vacuum polarization in quantum electrodynamics.

L005412(len)

source
IntegerSequences.is206864Function

Is $n$ a prime of the form $𝚽_k(m)$ with $k > 2$ and $|m| > 1$ where $𝚽_k(m)$ denotes the $k$-th cyclotomic polynomial evaluated at $m$.

is206864(n)

source
IntegerSequences.is206942Function

Is $n$ a numbers of the form $𝚽_k(m)$ with $k > 2$ and $|m| > 1$ where $𝚽_k(m)$ denotes the $k$-th cyclotomic polynomial evaluated at $m$.

is206942(n)

source
IntegerSequences.V007060Function

Return $(2n)!$ Hypergeometric1F1$[-n, -2n, -2]$. Number of ways $n$ couples can sit in a row without any spouses next to each other.

V007060(n)

source
IntegerSequences.V007917Function

Return the largest prime in $N$ (the semiring of natural numbers including zero) less than n for $n ≥ 0$. (The prev_prime function of Mathematica, Maple, Magma and SageMath.)

V007917(n)

source
IntegerSequences.L008784Function

Return numbers $n$ that are primitively represented by $x^2 + y^2$. Also numbers $n$ such that $√(-1)$ mod $n$ exists.

L008784(bound)

source
IntegerSequences.T011117Function

Return the number of lattice paths from $(0,0)$ to $(x,y)$ that never pass below $y = x$ and use step set ${(0,1), (1,0), (2,0), (3,0), ...}$.

T011117(n)

source
IntegerSequences.L013928Function

Return a list of the number of squarefree numbers $< n$.

julia> L013928(8)
[0, 1, 2, 3, 3, 4, 5, 6]
L013928(len)

source
IntegerSequences.L025528Function

Return a list of the number of prime powers $≤ n$ with exponents $k ≥ 1$.

julia> L025528(8)
[0, 0, 1, 2, 3, 4, 4, 5]
L025528(len)

source
IntegerSequences.L036039Function

Return the multinomial coefficients of the integer partitions of $n$. Gives the number of permutations whose cycle structure is the given partition.

julia> L036039(5)
[24, 30, 20, 20, 15, 10, 1]
L036039(n)

source
IntegerSequences.T039683Function

Return the signed double Pochhammer triangle: expansion of $x(x-2)(x-4)..(x-2n+2)$.

julia> ShowAsΔ(T039683(5))
1
0 1
0 2 1
0 8 6 1
0 48 44 12 1
T039683(n)

source
IntegerSequences.T051141Function

Return the triangle $3^{n-m}S1(n, m)$ where S1 are the signed Stirling numbers of first kind.

julia> ShowAsΔ(T051141(5))
1
0 1
0 3 1
0 18 9 1
0 162 99 18 1
T051141(n)

source
IntegerSequences.T051142Function

Return the Bell transform of the MultiFactorial numbers of type (4,4).

julia> ShowAsΔ(T051142(5))
1
0 1
0 4 1
0 32 12 1
0 384 176 24 1
T051142(n)

source
IntegerSequences.T060693Function

Return the number of Schroeder paths (i.e., consisting of steps $U=(1,1), D=(1,-1), H=(2,0)$ and never going below the x-axis) from $(0,0)$ to $(2n,0)$, having $k$ peaks.

T060693(n)

source
IntegerSequences.L062980Function

Return the number of rooted unlabeled connected triangular maps on a compact closed oriented surface with $2n$ faces.

L062980(len)

source
IntegerSequences.L065515Function

Return the number of powers of primes $≤ n$. (Powers of primes are numbers of the form $p^k$ where $p$ is a prime and $k ≥ 0$.)

julia> L065515(8)
[0, 1, 2, 3, 4, 5, 5, 6]
L065515(len)

source
IntegerSequences.L065619Function

Computes a list of length len of the integer Bernoulli numbers $b_{2}(n)$ using Seidel's boustrophedon algorithm.

L065619(len)

source
IntegerSequences.L065855Function

Return a list of the number of composite numbers $≤ n$.

julia> L065855(8)
[0, 0, 0, 0, 1, 1, 2, 2]
L065855(len)

source
IntegerSequences.L069637Function

Return a list of the number of prime powers $≤ n$ with exponents $k ≥ 2$.

julia> L069637(8)
[0, 0, 0, 0, 1, 1, 1, 1]
L069637(len)

source
IntegerSequences.L082298Function

Return the number of lattice paths from $(0,0)$ to $(n+1,n+1)$ that consist of steps $(i,0)$ and $(0,j)$ with $i,j≥1$ and stay strictly below the diagonal line $y=x$ except at the endpoints.

L082298(len)

source
IntegerSequences.T084938Function

Return the number of permutations of ${1,2,...,n}$ having $k$ cycles such that the elements of each cycle of the permutation form an interval. (Ran Pan)

T084938(n)

source
IntegerSequences.L089270Function

Return positive numbers represented by the integer binary quadratic form $x^2+xy-y^2$ with $x$ and $y$ relatively prime.

L089270(bound)

source
IntegerSequences.T094665Function

Return the number of increasing 0-2 trees (A002105) on $2n$ edges in which the minimal path from the root has length $k$.

T094665(n)

source
IntegerSequences.V097383Function

Minimum total number of comparisons to find each of the values $1$ through $n$ using a binary search with $3$-way comparisons.

V097383(n)

source
IntegerSequences.T104556Function

Return the matrix inverse of coefficients of Bessel polynomials; essentially the same as coefficients of modified Hermite polynomials T096713.

julia> ShowAsΔ(T104556(5))
1
0 1
0 -1 1
0 0 -3 1
0 0 3 -6 1
T104556(n)

source
IntegerSequences.T119274Function

Return the triangle of coefficients of numerators in Pade approximation to $e^x$.

julia> ShowAsΔ(T119274(5))
1
0 1
0 2 1
0 12 6 1
0 120 60 12 1
T119274(n)

source
IntegerSequences.T132062Function

Return the triangle of coefficients of Bessel polynomials, also the Sheffer triangle $(1, 1 - √(1 - 2x))$ (Cf. A001497).

julia> ShowAsΔ(T132062(5))
1
0 1
0 1 1
0 3 3 1
0 15 15 6 1
T132062(n)

source
IntegerSequences.T137452Function

Return the coefficients of the first $n$ Abel polynomials.

julia> ShowAsΔ(T137452(5))
1
0 1
0 -2 1
0 9 -6 1
0 -64 48 -12 1
T137452(n)

source
IntegerSequences.T137513Function

Return the triangle of the coefficients of the Mittag-Leffler polynomials.

julia> ShowAsΔ(T137513(5))
1
0 2
0 0 4
0 4 0 8
0 0 32 0 16
T137513(n)

source
IntegerSequences.L167872Function

Return half the number of Feynman diagrams of order $2(n+1)$, for the electron self-energy in quantum electrodynamics.

L167872(len)

source
IntegerSequences.T203412Function

Return the Bell transform of the MultiFactorial numbers of type (3,1).

julia> ShowAsΔ(T203412(5))
1
0 1
0 1 1
0 4 3 1
0 28 19 6 1
T203412(n)

source
IntegerSequences.T216916Function

Return the coefficients of some orthogonal polynomials related to set partitions without singletons (cf. A000296).

T216916(dim)

source
IntegerSequences.T217537Function

Return the coefficients of some orthogonal polynomials related to indecomposable set partitions without singletons (cf. A098742).

T217537(dim)

source
IntegerSequences.L243655Function

Return positive numbers that are primitively represented by the indefinite quadratic form $x^2 - 3y^2$ of discriminant 12.

L243655(bound)

source
IntegerSequences.L246547Function

Return a list of perfect powers of length len. (Numbers of the form $p^k$ where $p$ is a prime and $k ≥ 2$.

julia> L246547(8)
[4, 8, 9, 16, 25, 27, 32, 49]
L246547(len)

source
IntegerSequences.L246655Function

Return a list of prime powers of length len. (Numbers of the form $p^k$ where $p$ is a prime and $k ≥ 1$.)

julia> L246655(8)
[2, 3, 4, 5, 7, 8, 9, 11]
L246655(len)

source
IntegerSequences.V251568Function

Return $((2n)!/(n+1)!)$ Hypergeometric1F1$[1-n, n+2, -1]$. Egf. exp $(x C(x)^2)$ where $C(x) = 1 + xC(x)^2$ is the generating function of the Catalan numbers.

V251568(n)

source
IntegerSequences.L262071Function

Return the number of ordered partitions of an n-set with nondecreasing block sizes and maximal block size equal to k.

L262071(n)

source
IntegerSequences.T264428Function

Return the Bell transform of the Bell numbers.

julia> ShowAsΔ(T264428(5))
1
0 1
0 1 1
0 2 3 1
0 5 11 6 1
T264428(n)

source
IntegerSequences.T265606Function

Return the Bell transform of the quartic factorial numbers.

julia> ShowAsΔ(T265606(5))
1
0 1
0 1 1
0 5 3 1
0 45 23 6 1
T265606(n)

source
IntegerSequences.L292222Function

Return the triangle of multinomial coefficients of $n$. [Defined as in the 'Handbook of Mathematical Functions', p. 831, as $M1$.]

L292222(n)

source
IntegerSequences.L328917Function

Return the types of signatures of partitions of n, ordered firstly by decreasing greatest parts, then decreasing sum of parts, then by increasing number of parts.

L328917(n)

source