Skip to content

Instantly share code, notes, and snippets.

@joelandman
Created November 29, 2017 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joelandman/191bf56e64d8393ff79057480aae0ce5 to your computer and use it in GitHub Desktop.
Save joelandman/191bf56e64d8393ff79057480aae0ce5 to your computer and use it in GitHub Desktop.
Julia code for overflow play
#!/usr/bin/env julia
x = "1234"
while length(x) < 100 * 1024
x *= x;
end
y = parse(BigInt,x)
@joelandman
Copy link
Author

julia> x = "1234"
"1234"

julia> while length(x) < 100 * 1024
x *= x;
end

julia> x
"123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123

...

123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234

julia> y=parse(BigInt,x)
1234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234

...

1234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234123412341234

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment