Learn R Programming

Zseq (version 0.2.0)

Carmichael: Carmichael numbers

Description

Under OEIS A002997, a Carmichael number is a composite number \(n\) such that $$b^{n-1} = 1 (mod n)$$ for all integers \(b\) which are relatively prime to \(n\). First 6 Carmichael numbers are 561, 1105, 1729, 2465, 2821, 6601.

Usage

Carmichael(n, gmp = TRUE)

Value

a vector of length n containing first entries from the sequence.

Arguments

n

the number of first n entries from the sequence.

gmp

a logical; TRUE to use large number representation, FALSE otherwise.

Examples

Run this code
## generate first 3 Carmichael numbers
print(Carmichael(3))

Run the code above in your browser using DataLab