How to read in a list of integers into an array

Edit: Nvm this answer, see answer below.

Ah, I didn’t look at the sample file and didn’t notice you needed that big numbers. It probably makes sense to write your own little parser function then like

function read_data(s) 
    joined = join(split(s))
    no_brackets = SubString(joined, nextind(joined, 1), prevind(joined, lastindex(joined)))
    return parse.(BigInt, split(no_brackets, ','))
end
julia> read_data(s)
150-element Array{BigInt,1}:
                                                4
                                               12
                                               32
                                               80
                                              192
                                              448
                                             1024
                                             2304
                                             5120
                                            11264
                                            24576
                                            53248
                                           114688
                                           245760
                                           524288
                                          1114112
                                          2359296
                                          4980736
                                         10485760
                                         22020096
                                         46137344
                                         96468992
                                        201326592
                                        419430400
                                        872415232
                                                ⋮
        10803965149739796214962143785958640713728
        21778071482940061661655974875633165533184
        43896425332801061786775324358698099277824
...
3 Likes