Learn R Programming

exams.forge (version 1.0.10)

divisor_25: Number Properties

Description

  • is_terminal checks whether x's can be expressed as a terminal fraction, basically divisor_25(denominator(x))

  • divisor_25 checks whether all x's can be expressed as \(2^x 5^y\)

  • prime_numbers returns all prime numbers up to a limit

  • primes prime factorization of x, returns a matrix with the power of each prime number

  • has_digits checks whether the x's have only digits after the decimal point, basically abs(x-round(x, digits))<tol

  • all_integer checks whether all x's are integer, basically all(has_digits(x,0))

Usage

divisor_25(x)

denominator_25(x)

is_terminal(x)

round_25(x)

prime_numbers(n, sieve = FALSE)

primes(x, min = 2)

has_digits( x, digits = 2, tol = 10^{ -digits - 6 } )

all_integer(x)

only_digits( x, digits = 2, tol = 10^{ -digits - 6 } )

is_term(x)

denom_25(x)

Value

logical

Arguments

x

numeric: values to test/check

n

integer: find all prime numbers up to n

sieve

logical: should in any case the Sieve of Eratosthenes be used to compute prime numbers (default: FALSE)

min

integer: the minimum prime number used (default: 2)

digits

numeric: number of digits to check (default: 2)

tol

numeric: max. deviation from the rounded x (default: 1e-6)

Examples

Run this code
is_terminal(2/3)   # 0.6666... non-terminal
is_terminal(1/5)   # 0.2       terminal
divisor_25(1:25)
prime_numbers(100) # all prime numbers less equal 100
primes(1:20)       # prime factorization of 1 to twenty

Run the code above in your browser using DataLab