Skip to content
Prev 371280 / 398530 Next

Optimize code to read text-file with digits

Ah, right. You do get all the digits, but in the order of the last digit of each 5 digit number, then all the penultimate digits, etc. To get digits in the right order, try
[1] 1 0 0 9 7 3 2 5 3 3 7 6 5 2 0 1 3 5 8 6 3 4 6 7 3 5 4 8 7 6 8 0 9 5
 [35] 9 0 9 1 1 7 3 9 2 9 2 7 4 9 4 5 3 7 5 4 2 0 4 8 0 5 6 4 8 9 4 7 4 2
 [69] 9 6 2 4 8 0 5 2 4 0 3 7 2 0 6 3 6 1 0 4 0 2 0 0 8 2 2 9 1 6 6 5

I.e., reverse the order of digit generation and transpose the matrix that outer() creates (because matrices are column-major).