1. For the 13th factorial, there are two ways to approach the situation without factorial() For Loop:
ans<-1
for(i in 13:1){
ans<- ans*i
}
print(ans)
## [1] 6227020800

While Loop:

ans<-1
i<-13
while(i!=1){
 ans<-ans*i
 i<-i-1
}
print(ans)
## [1] 6227020800
  1. To create a vector that has a sequence, we will use the seq()
nums<-seq(10,50,by=5)
print(nums)
## [1] 10 15 20 25 30 35 40 45 50
  1. For the “lines” function, it must calculate the distance between two points, the slope, and the y-intercept
lines <-function(x,y,x2,y2){
d<-sqrt((x2-x)^2+(y2-y)^2)
m<-(y2-y)/(x2-x)
b<- y-(m*x)
res<-list(d,m,b)
names(res)<-c("Distance","Slope","Y-intercept")
return(res)
}

lines(-4,-3,4,3)
## $Distance
## [1] 10
## 
## $Slope
## [1] 0.75
## 
## $`Y-intercept`
## [1] 0