@@ -35,7 +35,7 @@ Use `collect(partitions(n))` to get an array of all partitions.
3535The number of partitions to generate can be efficiently computed using
3636`length(partitions(n))`.
3737
38- See also:
38+ See also:
3939- [`integer_partitions(n::Integer)`](@ref)
4040 for a non-iterator version that returns all partitions as a array
4141- [`partitions(n::Integer, m::Integer)`](@ref)
@@ -536,15 +536,31 @@ end
536536"""
537537 prevprod(a::Vector{Int}, x)
538538
539- Previous integer not greater than `x` that can be written as `` \\ prod k_i^{p_i}`` for
540- integers ``p_1``, ``p_2``, etc .
539+ Find the largest integer not greater than `x`
540+ that can be expressed as a product of powers of the elements in `a` .
541541
542- For integers ``i_1``, ``i_2``, ``i_3``, this is equivalent to finding the largest ``x``
543- such that
542+ This function computes the largest value `y ≤ x` that can be written as:
543+ ```math
544+ y = \\ prod a_i^{n_i}
545+ = a_1^{n_1} a_2^{n_2} \\ cdots a_k^{n_k}
546+ \\ leq x
547+ ```
548+ where ``n_i`` is a non-negative integer, `k` is the length of Vector `a`.
549+
550+ # Examples
551+ ```jldoctest
552+ julia> prevprod([10], 1000) # 1000 = 10^3
553+ 1000
554+
555+ julia> prevprod([2, 5], 30) # 25 = 2^0 * 5^2
556+ 25
544557
545- ``i_1^{n_1} i_2^{n_2} i_3^{n_3} \\ leq x``
558+ julia> prevprod([2, 3], 100) # 96 = 2^5 * 3^1
559+ 96
546560
547- for integers ``n_1``, ``n_2``, ``n_3``.
561+ julia> prevprod([2, 3, 5], 1) # 1 = 2^0 * 3^0 * 5^0
562+ 1
563+ ```
548564"""
549565function prevprod (a:: Vector{Int} , x)
550566 if x > typemax (Int)
0 commit comments