Skip to main content
1 of 4
Giuseppe
  • 29.4k
  • 3
  • 33
  • 106

R, 32 bytes

function(n,`?`=cumsum)n%in%??1:n 

Try it online!

Double cumsum from the Lyxal answers.

Giuseppe
  • 29.4k
  • 3
  • 33
  • 106