## Transcribed Text

1. Calculate the sum Pn
j=1 j and compare with n(n + 1)/2, for n =
400, 600, 800, 1000. Use the formula to compute Pn
j=1 j for all values of
n between 1 and 100.
2. Using rep(), : and c()as needed, create the vectors below. To make
it harder: in each expression you can only use each function at most
twice, and with at most 2 arguments. So
c(1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5, 1, 2, 3, 4, 5)
is not allowed!)
(a) 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
(b) 0 1 1 2 2 2 3 3 3 3 4 4 4 4 4 5 5 5 5 5 5
(c) 1 2 2 3 3 3 1 2 2 3 3 3 1 2 2 3 3 3
(d) "red" "red" "red" "green" "green" "blue"
3. Use R to find the remainder r when dividing 664055 by 243219. Use R
to find the whole number part w of the ratio 664055/243219. Use R to
confirm that 664055 = 243219w + r.
4. Use R to find the binary expansion of 1/7 to 8 binary places. Let
x be the number just computed. By hand using binary arithmetic,
compute 2x as x + x. By hand using binary arithmetic, compute 4x as
2x+ 2x. By hand using binary arithmetic, compute 4x+ 2x+x. Using
1
R, compute the decimal representation of your final answer. Explain
why you did not get 1.
5. Use the options() function in R to set the number of digits to display
to 20. Compute and print 10i + 1 for i = 0, . . . , 20 using a single R
statement. Identify and explain cases where R prints the wrong answer.
6. Plot the values 1015+i for i = 1, . . . , 100. (To do this, put the values in a
variable x, and run plot(x).) Plot the values 1016+i for i = 1, . . . , 100.
Plot the values 1017+i for i = 1, . . . , 100. Explain why these three plots
look so different, and why each one looks the way it does.

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction
of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice.
Unethical use is strictly forbidden.

### 1.

```{r}

sum(1:400)

sum(1:600)

sum(1:800)

sum(1:1000)

n <- 1:100

n*(n+1)/2

```

### 2.

#### (a)

```{r}

v <- rep(1:5,4)

```

#### (b)

```{r}

v <- rep(1:6,1:6)-1

```

### (c)

```{r}

v <- rep( rep(1:3,1:3), 3)

```

### (d)

```{r}

v <- rep(c("red","green","blue"),3:1)...