# nextprod

nextprod([k_1,k_2,...], n)

Next integer not less than `n`

that can be written as $\prod k_i^{p_i}$ for integers $p_1$, $p_2$, etc.

## Examples

The `nextprod`

function in Julia returns the next integer not less than `n`

that can be written as the product of `k_i`

raised to certain powers `p_i`

.

```
julia> nextprod([2, 3], 10)
12
```

This example finds the next integer greater than or equal to 10 that can be written as the product of powers of 2 and 3. In this case, the next integer is 12, which is equal to `2^2 * 3^1`

.

```
julia> nextprod([2, 3], 20)
24
```

Here, the next integer greater than or equal to 20 that can be expressed as the product of powers of 2 and 3 is 24 (`2^3 * 3^1`

).

```
julia> nextprod([2, 3, 5], 100)
120
```

In this example, the next integer not less than 100 that can be represented as the product of powers of 2, 3, and 5 is 120 (`2^3 * 3^1 * 5^1`

).

Common mistake example:

```
julia> nextprod([2, 3], -5)
ERROR: ArgumentError: invalid nextprod arguments: -5
```

The `nextprod`

function expects a positive value for `n`

. If a negative value is provided, it will throw an `ArgumentError`

. Ensure that `n`

is greater than or equal to zero when using `nextprod`

.

## See Also

abs2, beta, binomial, ceil, cell, cross, ctranspose, ctranspose!, cummin, cumprod, cumprod!, cumsum, cumsum!, cumsum_kbn, div, divrem, eigfact, eigfact!, eigmin, eps, erf, erfc, erfcinv, erfcx, erfi, erfinv, exp, exp10, exp2, expm1, exponent, factor, factorial, factorize, floor, gcd, invmod, log, log10, log1p, log2, logspace, max, min, mod, mod1, modf, next, nextpow, nextprod, num, primes, primesmask, prod, realmin, sqrt, sum!, sumabs, sumabs!, sumabs2, sumabs2!,## User Contributed Notes

### Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.