I have a 309 digit integer, I want to iterate through its characters.
Currently I am using:
require 'openssl'
e = 116505013962726356794269846667188147473899121100449069443844506823885859211073843523906823741034558875724969276233769835502344452366515593952571468651971447660633083078837371793388842846199643249996094940742465135064478448126948741186882484457847959126808512823416166517945252986434515406363102297514031583117
and I have:
e.times do |i|
...
end
Which, understandably, yields an error:
undefined method `times' for #<OpenSSL::BN:0x007fec05002140>
I attempted to convert the bignum to an integer:
e.to_i.times do |i|
...
end
Which returned:
bignum too big to convert into `long'
I understand why I am receiving these errors, but I am asking how do I iterate through each character of such a large number?