Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Project: REU 2017
Views: 96
#Returns the Lucas Carmichael numbers in a given interval. Uses the korselt criterion for lucas groups. This criterion says that N is Carmichael iff N is squarefree and for each q dividing N it is true that (q-(D|q)) divides (N-(D|N)). #You input the Lucas group parameter, D, and the interval in which you are searching for Lucas group Carmichael numbers. It will output a list with the values of N that are Lucas group Carmichael numbers. def lkorselt(D,interval): carmichael=[]#Where we store the lucas carmichael numbers for N in range(1,interval): if N%2==1 and not Integer(N).is_prime(): primes=list(factor(N)) sf=1 #Here we check whether or not N is squarefree for i in primes: if sf==0: continue if i[1]!=1: sf=0 if sf==0: continue else: jacobi=1 #Here we check to see whether or not the second part of the definition is satisfied. for i in primes: if jacobi==0: continue if (N-jacobi_symbol(D,N))%(i[0]-jacobi_symbol(D,i[0]))!=0: jacobi=0 if jacobi==0: continue else: carmichael.append(N) return carmichael #The following code generates the sequence: D=9697 print "D=",D print lkorselt(D,1000000)