Skip to main content
added 97 characters in body
Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214

Python 2, 3229 bytes

lambda n,k:sum(range(1+kk,0,-n)[:)

Try it online!

Thanks to totallyhuman for -3 bytes!


Python 2, 30 bytes

f=lambda n,k:k>0and k+f(n,k-n]n)

Try it online!Try it online!

Python 2, 32 bytes

lambda n,k:sum(range(1+k)[::-n])

Try it online!

Python 2, 29 bytes

lambda n,k:sum(range(k,0,-n))

Try it online!

Thanks to totallyhuman for -3 bytes!


Python 2, 30 bytes

f=lambda n,k:k>0and k+f(n,k-n)

Try it online!

Source Link
Mr. Xcoder
  • 42.5k
  • 9
  • 81
  • 214

Python 2, 32 bytes

lambda n,k:sum(range(1+k)[::-n])

Try it online!