Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
不使用任何控制流语句,即 ,if来while编写一个列出所有此类三元组的 R 函数{a, b, c} less than 1000 and a < b < c。除了知道哪个函数会有所帮助之外,我不知道如何解决这个问题。我猜它是某种递归。
if
while
{a, b, c} less than 1000 and a < b < c
# Just because I think this is pretty xx <- (1:1000) ^2 xy <- combn(xx,2) xz <- rbind(xy, colSums(xy)) xp <- xz[, xz[3,] %in% xx] sqrt(xp)