def carmichael1(a,b,limit=1000):
    """
    carmichael(a,b)
    For a,b (odd primes) returns array of c
    such that a*b*c is a Carmichael number
    """
    if a==b or a==2 or b==2: return []
    if not is_prime(a) or not is_prime(b): return []
    ab=a*b
    l=lcm(a-1,b-1)
    m1=ab%l
    m2=invert(m1,l)
    abl=ab*l
    c=m2
    while c<=max(a,b):
        c+=l
    xm1=ab*c-1
    solutions=[]
    while c<=limit:
        if (xm1)%(c-1)==0 and is_prime(c):
            solutions.append(c)
        c+=l
        xm1+=abl
    return solutions

    carmichael(a,b)
    For a,b (odd primes) returns array of c
    such that a*b*c is a Carmichael number
    
recipes/Python/576902_Mr/recipe-576902.py