Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
9
Task/Floyds-triangle/R/floyds-triangle.r
Normal file
9
Task/Floyds-triangle/R/floyds-triangle.r
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Floyd <- function(n)
|
||||
{
|
||||
#The first argument of the seq call is a well-known formula for triangle numbers.
|
||||
out <- t(sapply(seq_len(n), function(i) c(seq(to = 0.5 * (i * (i + 1)), by = 1, length.out = i), rep(NA, times = n - i))))
|
||||
dimnames(out) <- list(rep("", times = nrow(out)), rep("", times = ncol(out)))
|
||||
print(out, na.print = "")
|
||||
}
|
||||
Floyd(5)
|
||||
Floyd(14)
|
||||
Loading…
Add table
Add a link
Reference in a new issue