def clambda(n):
    """
    clambda(n)
    Returns Carmichael's lambda function for positive integer n.
    Relies on factoring n
    """
    smallvalues=[1,1,2,2,4,2,6,2,6,4,10,2,12,6,4,4,16,6,18,4,6,10,22,2,20,12,18,\
    6,28,4,30,8,10,16,12,6,36,18,12,4,40,6,42,10,12,22,46,4,42,20,16,12,52,18,\
    20,6,18,28,58,4,60,30,6,16,12,10,66,16,22,12,70,6,72,36,20,18,30,12,78,4,54,\
    40,82,6,16,42,28,10,88,12,12,22,30,46,36,8,96,42,30,20]

    if n<=100: return smallvalues[n-1]
    factors=factor(n)
    l1=[]
    for p,e in factors:
        if p==2 and e>2:
            l1.append(2**(e-2))
        else:
            l1.append((p-1)*p**(e-1))
    return reduce(lambda a,b : lcm(a,b), l1)

    clambda(n)
    Returns Carmichael's lambda function for positive integer n.
    Relies on factoring n
    
recipes/Python/576902_Mr/recipe-576902.py