Because of the order of evaluation and value substitution during parameter compiling, the algorithm you are trying to use cannot work with green variables.
Here is a variation that will work:
"round to nearest prime"
(?NumberVoices / ?VoiceNumber) of:
{ | lastPrime backwardsList |
lastPrime := 97.
backwardsList :=
(100 to: 1 by: -1) collect: [ :x |
x isPrime ifTrue: [lastPrime := x].
lastPrime].
backwardsList reverse}
The expression in the curly braces creates an Array containing the next prime greater than or equal to the array index (for example, at index 6 the value is 7), up to an index of 100.
Since of: truncates the index and treats zero as meaning the first index of the Array, you do not need to use ceiling.