# Math

## R and Python Functions For Detecting Prime Numbers

R function: is_prime <- function(x) { !any(x %% 2:(x-1) == 0L) } Examples: is_prime(7) ## [1] TRUE is_prime(934213) ## [1] FALSE is_prime(934213) ## [1] FALSE is_prime(999983) ## [1] TRUE Python function:

## Derivation of Generalization of the Gamma Function

The following definite integral problem was posted on stackexchange.com today. $$$1.35 \times10^-7\int e^{-0.03x}x^4dx \tag{1}$$$ The version of the gamma function, a useful function for solving improper integrals, that I learned as an undergraduate physics major is \[ \int_{0}^{\infty} e^{-x}x^ndx = n!