Fusc sequence: Difference between revisions

→‎{{header|R}}: Improved speed and readability of which() calls.
m (→‎{{header|Perl}}: terminology)
(→‎{{header|R}}: Improved speed and readability of which() calls.)
Line 2,324:
 
A proper solution that only gives one non-trivial result is as follows:
<lang r>index<-which.max(nchar(first61)==2)[1]
number<-first61[index]
cat("The first fusc number that is longer than all previous fusc numbers is",number,
Line 2,331:
<lang r>twentyMillion<-firstNPlus1FuscNumbers(2*10^7-1)
twentyMillionCountable<-format(twentyMillion,scientific = FALSE,trim = TRUE)
indices<-sapply(2:6, function(x) (which.max(nchar(twentyMillionCountable)==x))[1])
numbers<-twentyMillion[indices]
cat("Some fusc numbers that are longer than all previous fusc numbers are:\n",
331

edits