I run this short program in python, but it outputs memory error. I use Sublime Text. My memory usage as I saw in System moniter was just normal, I had more than 2gb memory left.
def is_Prime(p):
    d=int(math.sqrt(p))
    if (p**2)% 12 == 1:
        if p==1:
            return 0
        for i in range(7, d+1, 6):
            if p%i==0:
            return 0
        for i in range(5, d+1, 6):
            if p%i==0:
                return 0    
        return 1
    else:
        if p==2 or p==3:
            return 1
        return 0
is_Prime(2425967623052370772757)


xrange()instead might help.range(7, d+1, 6)is generating a BIG list in Python 2...range(d)will create list which is over 4GB. When it comes to fail creating list, the memory space of the list will be released. Probability by using System monitor you can see increasing memory usage and sudden decreasing.