def IsPractical(n):

    if n % 2 != 0: return False

    #D = divisors(n)
    #if sum(D) == n*2: return True

    lg = log(n) / log(2)
    if lg == int(lg): return True

    F = RetFact(n)
    S = sorted(list(set(F)))

    for k in range(1, len(S)):
        a = S[k]
        f = S[:k]
        v = 1
        for fn in f:
            v *= fn**F.count(fn)
        w = sum(divisors(v)) + 1
        if a > w:
            print a, w, n, S
            return False

    print "Yes", n
    return True
def IsPractical(n):

  if n%2 != 0: return False
  
  #D = divisors(n)
  #if sum(D) == n*2: return True
  
  lg = log(n)/log(2)
  if lg == int(lg): return True
  
  F = RetFact(n)
  S = sorted(list(set(F)))
  
  for k in range(1,len(S)):
    a = S[k]
    f = S[:k]
    v = 1
    for fn in f:
      v*= fn**F.count(fn)
    w = sum(divisors(v)) + 1
    if a > w:
      print a, w,n,S  
      return False
  
  print "Yes",n
  return True
def cntpowers(x):

  z = RetFact(x)
  S = set(z)
  summ = 0
  for SS in S:
    summ += z.count(SS)
  return summ
Exemple #4
0
def cntpowers(x):

    z = RetFact(x)
    S = set(z)
    summ = 0
    for SS in S:
        summ += z.count(SS)
    return summ
#  x + y = xy/n
#
#  1/x = 1/n - 1/y
#
#
#
from Functions import RetFact, IsPrime
n = 1260  #500000000
maxx = 0
for n in xrange(10**8, 10**9):  #15000):
    if IsPrime(n): continue
    x = RetFact(n**2)
    s = set(x)
    facts = []
    for f in s:
        facts.append(x.count(f) + 1)
    m = 1
    for f in facts:
        m *= f
    m += 1
    m /= 2

    if m > maxx:
        maxx = m
        print "!!!!!", n, ":", m
    else:
        print n, ":", m
    if maxx > 4000000: print "Over 4 Mil!", n, m

print
print "# of solutions for", n, "is", maxx
        return False
  return True

d = divisors(120120)

x=[]
s=set(x) 
s2=set(x)

for x in d:

  z = RetFact(x)
  S = set(z)
  summ = 0
  for SS in S:
    summ += z.count(SS)
  if summ == 4:
    print x


# for x in d:
  # z = RetFact(x)
  # two = z.count(2)
  # zz = x/(2**two)
  # zzz = 3**(two+1)*zz
  # if zzz>(120120/4):
    # print x,two, zz,z


# for i in xrange(126,2,-1):
  # s = set([d[i]])
#  x + y = xy/n
#
#  1/x = 1/n - 1/y
#  
#
#
from Functions import RetFact, IsPrime
n = 1260 #500000000
maxx = 0
for n in xrange(10**8, 10**9):  #15000):
  if IsPrime(n):continue
  x = RetFact(n**2)
  s = set(x)
  facts = []
  for f in s:
    facts.append(x.count(f)+1)
  m=1
  for f in facts:
    m*=f
  m+=1
  m/=2

  if m>maxx:
    maxx=m
    print "!!!!!",n,":",m
  else:
    print n,":",m
  if maxx>4000000:print "Over 4 Mil!",n,m

print
print "# of solutions for",n, "is", maxx