/* Non-Linear Equation Solver that approximates the solution to
X^4 + 3*X^3 - 2*X^2 = 543007 by searching in increments of .001 */
input z
1
end
expand = 1000000
* the program searches for the answer in increments of .001
gen x=_n/1000
gen alex = x^4 + 3*x^3 -2*x^2 - 543007
gen m=_n
sort m
* note that that for small x values that alex < 0, we search for that value of x such that alex was < 0 but then alex > 0
keep if alex[_n-1]<0 alex="" amp="" n="">0
list x alex
Here is a program for figuring out whether any positive integer is prime or not;
input z
1
end
expand = 4935679
gen x=_n
gen prime= 4935679/x
gen m=int(prime)
keep if prime-m==0
count
list
* If more than 2 rows appear then the number (in this case 4935679) isn't prime