Ok, so I started with creating the maths behind a prime number identifier. I used a generate rows tool using RowCount <= sqrt([Number]) as the expression, beginning at 1 and looping by +1. Effectively this creates every factor between 1 and the square root of the number.
In the example of 100, this creates rows between 1 and 10.
Dividing 100 by each of these numbers and you are presented with decimal numbers and/or factors. I then split the resulting column by the decimal point and counted the instances of a null in the second column. This counts the numbers of results without a decimal place, ie a full number. this represents a number by which the original number is divisible.
Once I had determined if the number was prime, I changed the workflow to be an iterative macro, built in an iterative formula on the number and placed a filter on the field that determines if the number is prime. On the true output I placed a macro output which represents the end of the iteration, that is when the answer is Y, and on the false output I joined by to the input to form the iterative loop.
This is my iterative macro, "Prime". I then copied this, replaced the iterative + with iterative - to run down from the number and saved this as "Prime2":
I then built an analytic app to allow the user to select the number and an HTML output to view the results.
This will show the closest, next and previous prime number for any number selected (up to 100,000,000).