How do i make prime divisor finder script

so what I mean is a code that shows all prime divisors of a number.

Alright, let’s do this

First define the number as a variable, and then try this:
From my school experience I know that the prime divisors for a number are 1 and the number itself.
I kinda forgot.
If that is true:
Define the number as an IntValue or something else and then you can print("divisors of number .. number .. are 1 and .. number") (Not tested)
If that is false:
The same code above but first do some calculations; divide the number by 2 and so on until it gets 1. If the number is for example 5, check to see if the 5 divided by 2 result is a straight number, not something like 2.5.
That may require more scripting, but I am not able to give it, since I have no idea.

prime numbers are numbers that are divisible by itself and by 1
the smallest prime number is 2 and the odd even prime number is two

Thanks for remembering; try the code above.

words

1 Like