#!/bin/python3 import sys def getprimes(): p=[1]*int(1e6+1) p[3]=1 i=3 while i*i<=1e12: if p[i]==1: j=i*i while j*j<=1e12: p[j]=0 j+=i i+=2 pp=[2] for i in range(3,len(p),2): if p[i]==1: pp.append(i) return pp def getval(n,p,h): if n in h: return h[n] m=n nn=n p_i = 0 pr = p[p_i] while nn>1 and p_i