The basic technique for creating dynamic nested loops is to apply the foldl (fold-left) command to seq or one of its companion looping commands such as add. This is what @sursumCorda did. As he showed, making the loops dynamic by folding doesn't make them any faster, nor should you expect it to. But I did find 2 major ways to make the code faster, speeding up yours and @sursumCorda 's by a factor of at least 40 (i.e., 40 times faster).
The first improvement was to eliminate your innermost loop. That loop is simply counting (by repeatedly adding 1) a sequence of consecutive integers. If you know the integer bounds, the count can be done by simple subtraction of those bounds, plus 1. That's the significance of this expression, which is the innermost addend in my add loops:
max(0, min(_v||n1 + 1, V[-1]) - Ceil(V[-1]/2))
The second improvement is due to a Maple idiosyncracy: The command trunc is many times faster than ceil (or floor or the other commands of that ilk). By making a slight adjustment to trunc, it can replace ceil:
ceil(x) = trunc(x) + `if`(trunc(x)=x or x < 0, 0, 1)
With these changes, my final code is able to do the n=6 case in under 9 seconds.
nequaln:= (n::And(posint, Not(1)))->
local
i, %add, n1:= n-1,
V:= (n-2)*24 -~ (0, seq['scan'= `+`](_v||i, i= 2..n1)), #seq of partial sums
#Maple's library 'ceil' has a highly symbolic aspect that slows it significantly. (You
#can confirm this by showstat(ceil).) But 'trunc' is kernel builtin and doesn't have
#this problem. Thus, I wrote this version of 'ceil' that only uses 'trunc'.
Ceil:= x-> local T:= trunc(x);
`if`(T::integer, (thisproc(x):= T + `if`(T=x or x<0, 0, 1)), 'procname'(x))
;
(eval@subs)(
_v||1= V[1] - n1, %add= add,
foldl(
%add,
max(0, min(_v||n1 + 1, V[-1]) - Ceil(V[-1]/2)),
seq(_v||i= Ceil(V[i-1]/(n-i+2)).._v||(i-1), i= n1..2, -1)
)
)
:
[seq](CodeTools:-Usage(nequaln(k)), k= 2..6);
memory used=14.30KiB, alloc change=0 bytes, #Usage for k=2
cpu time=0ns, real time=2.00ms, gc time=0ns
memory used=285.20KiB, alloc change=0 bytes, #Usage for k=3
cpu time=15.00ms, real time=14.00ms, gc time=0ns
memory used=475.34KiB, alloc change=0 bytes, #Usage for k=4
cpu time=0ns, real time=9.00ms, gc time=0ns
memory used=13.45MiB, alloc change=0 bytes, #Usage for k=5
cpu time=79.00ms, real time=80.00ms, gc time=0ns
memory used=1.58GiB, alloc change=0 bytes, #Usage for k=6
cpu time=8.58s, real time=8.35s, gc time=437.50ms
[0, 48, 816, 10642, 117788]