This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 2 + (1000000-5) %/% 7 * 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(gmp) | |
| library(hash) | |
| h <- hash() | |
| n <- 1 | |
| maxDigits <- Inf | |
| repeat { | |
| v <- as.character(pow.bigz(n, 3)) | |
| s <- strsplit(v, "")[[1]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(pracma) | |
| library(gmp) | |
| p <- primes(1e6%/%21) | |
| answer <- 0 | |
| maxLength <- 0 | |
| while (length(p) > 0) { | |
| x <- rev((x <- cumsum(p))[x < 1e6]) | |
| while (length(x) > 0) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(pracma) | |
| xs <- colSums(t(perms(1:7)) * (10^(6:0))) | |
| for (x in xs) if(isprime(x)) {answer <- x; break} else next | |
| answer | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| limit <- 1 | |
| while (9^5*limit >= 10^limit) limit <- limit+1 | |
| n <- 2:(9^5*limit) | |
| f <- function(x, y) (x %/% 10^y %% 10)^5 | |
| sum(n[n == rowSums(outer(n, limit:0, f))]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(gmp) | |
| n <- factorialZ(100) | |
| sum(n %/% pow.bigz(10, (floor(log10(n)):0)) %% 10) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| library(pracma) | |
| sum(primes(2e6)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| f <- function(n) { | |
| x <- 999%/%n | |
| x * (x + 1) / 2 * n | |
| } | |
| f(3) + f(5) - f(15) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package heap | |
| type Node struct { | |
| Order | |
| tails | |
| } | |
| type Order interface { | |
| Ord(*Node) bool | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "time" | |
| ) | |
| type digits []int | |
| func (xs digits) nexts() (answer []digits) { |