In [1]:
import numpy as np
In [2]:
%%time
N = 10**12
x = np.arange(1,10**6+100)
div = x[N%x==0]
Wall time: 14 ms
In [3]:
div
Out[3]:
array([      1,       2,       4,       5,       8,      10,      16,
            20,      25,      32,      40,      50,      64,      80,
           100,     125,     128,     160,     200,     250,     256,
           320,     400,     500,     512,     625,     640,     800,
          1000,    1024,    1250,    1280,    1600,    2000,    2048,
          2500,    2560,    3125,    3200,    4000,    4096,    5000,
          5120,    6250,    6400,    8000,   10000,   10240,   12500,
         12800,   15625,   16000,   20000,   20480,   25000,   25600,
         31250,   32000,   40000,   50000,   51200,   62500,   64000,
         78125,   80000,  100000,  102400,  125000,  128000,  156250,
        160000,  200000,  250000,  256000,  312500,  320000,  390625,
        400000,  500000,  512000,  625000,  640000,  781250,  800000,
       1000000])