Skip to main content
2 of 2
added 49 characters in body
lyxal
  • 34.3k
  • 2
  • 64
  • 141

Scratch 3.0, 29 27 blocks/234 167 bytes

enter image description here

As SB Syntax:

define f(n)
if<(n)=(1)>then
add(1)to[v v
else
f((n)-(1
set[d v]to(item(length of[v v])of[v v
if<(n)>(d)>then
add((n)*(d))to[v v
else
add([floor v] of ((n)/(d)))to[v v]
end
end
when gf clicked
delete all of [v v
ask()and wait
f(answer)

Try it on scratch

I'm a little unsure of some input/output methods, so I thought I'd be safe and just make it a full program with a helper function.

Answering this allowed my account to be promoted from "new" to "standard", so that's always fun.

-67 bytes thanks to @att

lyxal
  • 34.3k
  • 2
  • 64
  • 141