Scratch 3.0, 2429 27 blocks/234234 167 bytes
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)
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