def carmichael2(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 []
    am1=a-1
    bm1=b-1
    am1bm1=am1*bm1
    g,s,t=gcdext(am1bm1,-(am1+b))
    c=((t*(am1+bm1)//g))%bm1+1
    while c<=max(a,b):
        c+=bm1
    xm1=(a)*(b)*(c)-1
    inc=a*b*bm1
    solutions=[]
    while c<=limit:
        if (xm1)%(c-1)==0 and is_prime(c):
            solutions.append(c)
        c+=bm1
        xm1+=inc
    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