# Cumulative product?

**URL:** https://discourse.julialang.org/t/cumulative-product/87118
**Category:** New to Julia
**Created:** [September 12, 2022, 8:50am UTC](https://discourse.julialang.org/t/cumulative-product/87118 "2022-09-12T08:50:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Nash](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nash/32/14482_2.png) [@Nash](https://discourse.julialang.org/u/Nash)
#### Post date: [September 12, 2022, 8:50am UTC](https://discourse.julialang.org/t/cumulative-product/87118/1 "2022-09-12T08:50:29Z")

</div>

What is the equivalent of cumsum for the product? For example, for the vector [2;2;2;5] I am looking for a function to get:

cumprod = [2;4;8;40]

---

<div class="post-metadata">

### Author: ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)
#### Post date: [September 12, 2022, 8:51am UTC](https://discourse.julialang.org/t/cumulative-product/87118/2 "2022-09-12T08:51:38Z")

</div>

It is called… `cumprod`

```julia
julia> cumprod([2, 2, 2, 5])
4-element Vector{Int64}:
  2
  4
  8
 40

```
