-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprint_U_k.Rmd
66 lines (43 loc) · 1.61 KB
/
print_U_k.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
title: "Print & Graph U_k"
author: "Marly Cormar"
date: "7/22/2018"
output:
html_document:
highlight: kate
theme: cosmo
pdf_document: default
---
```{r setup, echo=FALSE, warning=FALSE, message=FALSE}
knitr::opts_chunk$set(echo=FALSE, warning=FALSE, message=FALSE)
```
```{r install_packages, echo=FALSE, warning=FALSE, include=FALSE}
install.packages("kableExtra", repos = "http://cran.us.r-project.org")
library(kableExtra)
```
```{r, echo=FALSE}
# Variables to modify
smallest_prime_to_consider <- 2
max_k <- 23 # Max k for which to find U_k
max_prime <- 200 # max prime to consider
```
```{r, echo=FALSE, warning=FALSE, include=FALSE}
# Add the R script containing the functions used here
source("functions.R")
```
```{r, echo=FALSE}
# Find U_k for each k in [1:max_k] and make a plot
# The values of U_k for k in [1,23] are saved in ./data. To read them: readRDS('data/up_to_u_23')
set_of_union_of_sets_of_lengths <- find_set_of_union_of_sets_of_lengths(max_k)
max_length <- length(set_of_union_of_sets_of_lengths[[length(set_of_union_of_sets_of_lengths)]])
fill_list <- function(my_list){
diff_length <- max_length - length(my_list)
return(c(my_list, rep(" ", diff_length)))
}
set_of_union_of_sets_of_lengths <- lapply(set_of_union_of_sets_of_lengths, fill_list)
set_of_union_of_sets_of_lengths <- as.data.frame(set_of_union_of_sets_of_lengths)
colnames(set_of_union_of_sets_of_lengths) <- c(paste0("U~", 1:max_k, "~"))
kable(set_of_union_of_sets_of_lengths) %>%
kable_styling(bootstrap_options = c("striped", "hover", "condensed", "responsive"))
draw_plot(set_of_union_of_sets_of_lengths)
```