See https://scratch.mit.edu/discuss/topic/370957/ I have 4 solutions inside: The first uses 14 blocks. It responds correctly to the number 1. The second uses 13 blocks. It is a variation of the above and requires reloading the project to reset. It also works with the number 1. The third uses 13 blocks. It does not work with the number 1. The idea of running say multiple times came from @MartinBraendli's project linked below. The fourth uses 13 blocks. It freezes when the number 1 is inputed. The idea of incrementing upwards came from @MartinBraendli's project linked below. https://scratch.mit.edu/projects/332284115/ All of these can be modified to return a numeric result which must be interpreted (the last value of i). With the first three, this would mean the greatest divisor or 1 if prime. It would save 1 blocks for each. With the last, this would mean the greatest divisor or the inputed number if prime. It would save 2 blocks, meaning 11 blocks total.