#' @export
get_sequence <- function(A){
if(!is_sequence(A)){
stop("Sequence not in catalogue. See available sequence using oeis::sequences")
}
seq_b_url <- paste0("https://oeis.org/", A,"/",
paste0(gsub("A","b",A), ".txt"))
seq <- readr::read_delim(seq_b_url, delim = " ", col_names = FALSE,
comment = "#", col_types = "cc")
names(seq) <- c("n", "a")
seq
}
#' @export
as_numbers <- function(seq){
seq %>%
dplyr::mutate(dplyr::across(where(is.character), as.numeric))
}
#' @export
search_sequence <- function(keyword){
idx <- grepl(keyword, oeis::sequences[[2]])
oeis::sequences[idx,]
}
is_sequence <- function(A){
A %in% oeis::sequences[[1]]
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.