def __sub__(self, other): w = 1 / numpy.array([ k * numpy.ones(self.data.shape[1:]) for k in range(2, self.data.shape[0] + 2) ]) wt = numpy.repeat(numpy.expand_dims(numpy.sum(w, axis=0), axis=0), w.shape[0], axis=0) return numpy.sum(w / (wt * numpy.pi) * util.phi(self.data, other.data), axis=0)
def main(): temp = [i/phi(i) for i in range(1,1000001)] print temp.index(max(temp)) + 1
def __sub__(self, other): w = 1/numpy.array([ k * numpy.ones(self.data.shape[1:]) for k in range(2,self.data.shape[0]+2)]) wt = numpy.repeat(numpy.expand_dims(numpy.sum(w, axis=0), axis=0), w.shape[0], axis=0) return numpy.sum(w/(wt * numpy.pi) * util.phi(self.data, other.data), axis=0)
from util import phi n, max_val = 2, 1 for x in xrange(2,1000000+1): val = float(x) / phi(x) if val > max_val: n, max_val = x, val