def factor2(n):
if n<4:
- return []
+ return {n:1}
p = func.primes(int(n**.5+1))
f = {}
while n>1:
def possi(test):
return sum(catult(map(lambda x:test[x],test.keys()))[1:])+1
+def devisors(num):
+ test = factor2(num)
+ return sum(catult(map(lambda x:test[x],test.keys()))[1:])+1
+
# Eigene Loesung
for i in range(3,15000):
- if(possi(factor2(func.summandielle(i)))>500):
- print [possi(factor2(func.summandielle(i))), i, func.summandielle(i)],
+ if(possi(factor2(func.summandial(i)))>500):
+ print [possi(factor2(func.summandial(i))), i, func.summandial(i)],
break
# Phil Buff
else:
pos = possi(factor2(i))*possi(factor2((i+1)/2))
if(pos>500):
- print [possi(factor2(func.summandielle(i))), i, func.summandielle(i)],
+ print [possi(factor2(func.summandial(i))), i, func.summandial(i)],
break
def factor(n):
if n<4:
- return []
+ return [n]
p = primes(int(n**.5+1))
f = []
while n>1:
import func
-print abs(func.summandielle(100)**2 - reduce(lambda x,y:x+y*y,range(1,101),0))
\ No newline at end of file
+print abs(func.summandial(100)**2 - reduce(lambda x,y:x+y*y,range(1,101),0))
\ No newline at end of file
import math
# Berechnet die Summe aller vielfachen von base bis max
-def summandielle(max,base=1):
- max = int(max/base)*base
- return max*(max+base)/(2*base)
+def summandial(m,base=1):
+ m = int(m/base)*base
+ return m*(m+base)/(2*base)
# Gibt die naechst kleine Fib zu max zurueck
-def fib(max):
+def fib(m):
a,b = 1,2
- while b < max:
+ while b < m:
a,b = b,a+b
return a
# Gibt die Liste aller Fib zur naechst kleineren Fib von max zurueck
-def fib2(max):
+def fibV(m):
a = [1, 2]
i = 1;
- while a[i] < max:
+ while a[i] < m:
a.append(a[i] + a[i-1])
i = i+1
return a
# Gibt die Summe aller geraden Fib zu max zurueck
-def fibS(max):
+def fibS(m):
a,b = 1,2
- sum = 0
- while b < max:
+ s = 0
+ while b < m:
a,b = b,a+b
if a%2 == 0:
- sum = sum +a
-
- return sum
+ s = s +a
+ return s
+
# Gibt alle Primzahlen bis n zurueck
def primes(n):
if n < 2:
# Gibt alle Primfaktoren bis von n zurueck
def factor(n):
if n<4:
- return []
+ return [n]
p = primes(int(n**.5+1))
f = []
while n>1:
f.sort()
return f
-def factor2(n):
+def factorD(n):
if n<4:
- return []
+ return {n:1}
p = primes(int(n**.5+1))
f = {}
while n>1:
vek[j] = vek[j]+vek[j-1]*i
vek[len(vek):]=[0]
- return vek[:len(vek)-1]
\ No newline at end of file
+ return vek[:len(vek)-1]
+
+def divisors(num):
+ test = factorD(num)
+ return sum(ebinomial(map(lambda x:test[x],test.keys()))[1:])+1
\ No newline at end of file