SharedAsymptotics of norms.sagewsOpen in CoCalc
My First Program
113da9e-6020-4f35-b3de-d4541446f30
abs(-3)
3

from tqdm import tqdm

  

(q, x, y)
var('q,x,y')
#Produces tables that indicase distributions of gamma_S(r1,l1,r2,l2,n) for varying r1 and r2
#first prime ranges from l1start to l1stop, second prime ranges from l2start to l2stop
#lists n from N0 to N in table. probably limit range to 10 for the sake of visualization
#For N greater than 20, this will take more than a few minutes. for N around 30, this might take around 15 minutes. 
def Cnormstatistic(l1start,l1stop,l2start,l2stop,N0,N,h10,h20,h11):
    print "Hodge numbers are {}, {}, and {}. Euler is {} and Signature is {}.".format(h10,h20,h11,2-4*h10+2*h20+h11, 2*h20 + 2 -h11)
    
    def OnePrimes(n):
        lst = [1]
        for i in range(2,n+1):
            if i in Primes():
                lst.append(i)
        return lst
    
    SPrimes = OnePrimes(l1stop * l2stop + 1)

    def generatingFunctionWithPrecision(M):

        def numerator(NN):
            return prod(((1-x*q^n)*(1-x^(-1)*q^n)*(1-y*q^n)*(1-y^(-1)*q^n))^h10 for n in range (1,NN))

        def Denominator1(NN):
            return prod((sum((x*y*q^n)^k for k in range(0,NN))) for n in range(1,NN))
    
        def Denominator2(NN):
            return prod((sum((x^(-1)*y^(-1)*q^n)^k for k in range(0,NN))) for n in range(1,NN))

        def Denominator3(NN):
            if h20 == 0:
                return 1
            else:
                return prod((sum(binomial(k,h20-1)*(x^(-1)*y*q^n)^(k-h20+1) for k in range(h20-1,NN+h20-1))) for n in range(1,NN))
    
        def Denominator4(NN):
            if h20 == 0:
                return 1
            else:
                return prod((sum(binomial(k,h20-1)*(x*y^(-1)*q^n)^(k-h20+1) for k in range(h20-1,NN+h20-1))) for n in range(1,NN))

        def Denominator5(NN):
            if h11 == 0:
                return 1
            else:
                return prod((sum(binomial(k,h11-1)*(q^n)^(k-h11+1) for k in range(h11-1,NN+h11-1))) for n in range(1,NN))

        def genFxnHelper(NN):
            return numerator(NN) * Denominator1(NN) * Denominator2(NN) * Denominator3(NN) * Denominator4(NN) * Denominator5(NN)
    
        def genFxnUpTo(NN):
            return taylor(genFxnHelper(NN),q,0,NN)
        
        


        theFxn = genFxnUpTo(M+1)
        
        #print theFxn

        lstOfDumbCoeffs = [(k,theFxn.coefficient(q^k)) for k in range(1,M+1)]
        return lstOfDumbCoeffs
    
    theFxn = generatingFunctionWithPrecision(2*N)
    
   
    
    def Cfunction(r1,l1,r2,l2):

        def ComputeMatrix(m,theFxn1):
            #print "m={}".format(m)
            #print len(theFxn1)

            scaledFxn = x^m*y^m*theFxn1[m-1][1]
            #print "scaledFxn is {}".format(scaledFxn)

            # creates 2m+1 x 2m+1 list of zeros
            matrix = []
            for i in range(0,2*m+1):
                matrix.append([])
                for j in range(0,2*m+1):
                    matrix[i].append(0)

            # top left quadrant
            for i in range(0,m+1):
                for j in range(0,m+1):
                    matrix[i][j] = scaledFxn.coefficient(x^(i+m)*y^(j+m)).coefficient(x,0).coefficient(y,0)

            # top right quadrant
            for i in range(0,m+1):
                for j in range(m+1,2*m+1):
                    matrix[i][j] = scaledFxn.coefficient(x^(i+m)*y^(j-(m+1))).coefficient(x,0).coefficient(y,0)

            # bottom left quadrant
            for i in range(m+1,2*m+1):
                for j in range(0,m+1):
                    matrix[i][j] = scaledFxn.coefficient(x^(i-m-1)*y^(j+m)).coefficient(x,0).coefficient(y,0)

            # bottom right quadrant
            for i in range(m+1,2*m+1):
                for j in range(m+1,2*m+1):
                    matrix[i][j] = scaledFxn.coefficient(x,(i-m-1)).coefficient(y,(j-m-1))
    
            return matrix

        def natefunction(m):

            matrix = ComputeMatrix(m,theFxn)

            sum = 0
        
        
            for n in range(-m,m+1):
                if (n % l1) == r1:
                    for t in range(-m,m+1):
                        if (t % l2) == r2:
                            #print "about to input ({},{})".format(n,t)
                            #print "matrix size is {}".format(len(matrix))
                            sum = sum + matrix[n][t]
                        
        

            return sum
    
        lst = []
        for n in range(0,N+1):
            lst.append(natefunction(n))
        return lst
    
    for l1 in range(l1start,l1stop):
        if l1 in SPrimes:
            for l2 in range(l2start,l2stop):
                if l2 in SPrimes:
                    if (l1,l2) != (2,1) and (l1,l2) != (1,1):
                        print
                        print "l1 is {}, l2 is {}".format(l1,l2)


                        header= ["(r1,r2)"]

                        for n in range(N0,N+1):
                            header.append("n={}".format(n))

                        rows = [header]


                        for a in range(0,l1):
                            for b in range(0,l2):
                                lst = [(a,b)]
                                for n in range(N0,N+1):
                                    lst.append(Cfunction(a,l1,b,l2)[n])
                                rows.append(lst)


                        #return table(rows)

                        print

                        print "Exact values"

                        print table(rows)

                        print

                        #stats = rows

                        total = []

                        for a in range(0,N+1-N0):
                            colsum = 0
                            for t in range(1,l1*l2+1):
                                colsum = colsum + abs(rows[t][a+1])
                            total.append(colsum)

                        for a in range(0,N+1-N0):
                            #total = 0
                            #for t in range(1,l1*l2+1):
                                #total = total + rows[t][a+1]
                            #print total
                            for b in range(0,l1*l2):
                                if total[a] == 0:
                                    rows[b+1][a+1] = "N/A"
                                else:
                                    rows[b+1][a+1] = float(rows[b+1][a+1] / total[a])

                        print "Proportions"

                        print table(rows)
   

# Cnormstatistic(5,8,5,8,25,30,1,3,0)
# Cnormstatistic(5,8,5,8,25,30,1,5,2)
# Cnormstatistic(5,8,5,8,25,30,1,5,1)
#Cnormstatistic(1,3,1,3,25,30,3,2,1)
# for h10 in range(5,10):
#     for h20 in range(0,5):
#         for h11 in range(1,6):
#             Euler = 2*h20 + 2 + h11 - 4*h10
#             sig = 2*h20+2-h11
#             if Euler >= sig: and (Euler,sig) == (0,0):
#                 print 
#                 Cnormstatistic(1,3,1,3,25,30,h10,h20,h11)
Cnormstatistic(1,3,1,3,10,15,2,1,5)                
(q, x, y) Hodge numbers are 2, 1, and 5. Euler is 1 and Signature is -1. l1 is 1, l2 is 2 Exact values (r1,r2) n=10 n=11 n=12 n=13 n=14 n=15 (0, 0) 42 56 77 101 135 176 (0, 1) 0 0 0 0 0 0 Proportions (r1,r2) n=10 n=11 n=12 n=13 n=14 n=15 (0, 0) 1.0 1.0 1.0 1.0 1.0 1.0 (0, 1) 0.0 0.0 0.0 0.0 0.0 0.0 l1 is 2, l2 is 2 Exact values (r1,r2) n=10 n=11 n=12 n=13 n=14 n=15 (0, 0) 6788802 21827464 67294117 199825985 573638815 1596958576 (0, 1) -6788760 -21827408 -67294040 -199825884 -573638680 -1596958400 (1, 0) -6788760 -21827408 -67294040 -199825884 -573638680 -1596958400 (1, 1) 6788760 21827408 67294040 199825884 573638680 1596958400 Proportions (r1,r2) n=10 n=11 n=12 n=13 n=14 n=15 (0, 0) 0.250001160004 0.250000481046 0.250000214543 0.25000009477 0.250000044126 0.250000020664 (0, 1) -0.249999613332 -0.249999839651 -0.249999928486 -0.24999996841 -0.249999985291 -0.249999993112 (1, 0) -0.249999613332 -0.249999839651 -0.249999928486 -0.24999996841 -0.249999985291 -0.249999993112 (1, 1) 0.249999613332 0.249999839651 0.249999928486 0.24999996841 0.249999985291 0.249999993112
print "Euler is greater than zero, other is greater than zero"
print 
Cnormstatistic(2,6,1,5,25,30,0,4,1)
print
Cnormstatistic(2,6,1,5,25,30,0,8,2)
print
Cnormstatistic(2,6,1,5,25,30,3,12,1)
print



print "Euler is greater than zero, other equals zero"
print
Cnormstatistic(2,6,1,5,25,30,0,-1,2)
print
Cnormstatistic(2,6,1,5,25,30,1,1,4)
print
Cnormstatistic(2,6,1,5,25,30,2,3,8)
print



print "Euler is greater than zero, other is less than zero"
print
Cnormstatistic(2,6,1,5,25,30,2,0,8)
print
Cnormstatistic(2,6,1,5,25,30,4,0,20)
print
Cnormstatistic(2,6,1,5,25,30,8,0,40)
print



print "Euler equals zero, other equals zero"
print
Cnormstatistic(2,6,1,5,25,30,0,-1,0)
print
Cnormstatistic(2,6,1,5,25,30,2,3,0)
print
Cnormstatistic(2,6,1,5,25,30,8,15,0)
print



print "Euler equals zero, other is less than zero"
print
Cnormstatistic(2,6,1,5,25,30,1,0,2)
print
Cnormstatistic(2,6,1,5,25,30,3,0,10)
print
Cnormstatistic(2,6,1,5,25,30,6,0,22)
print



print "Euler is less than zero, other is less than zero"
print
Cnormstatistic(2,6,1,5,25,30,1,0,0)
print
Cnormstatistic(2,6,1,5,25,30,5,0,0)
print
Cnormstatistic(2,6,1,5,25,30,8,0,2)
print
Cstatistic(2,4,2,4,3,7,0,8,2)
Hodge numbers are 0, 8, and 2. Euler is 20 and other is 9. l1 is 2, l2 is 2 Exact values (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 676 8003 37494 232988 1057868 (0, 1) 0 0 0 0 0 (1, 0) 0 0 0 0 0 (1, 1) 1284 5682 45030 210882 1117932 Proportions (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 0.344897959184 0.584800876872 0.454340555475 0.524901435105 0.486197260778 (0, 1) 0.0 0.0 0.0 0.0 0.0 (1, 0) 0.0 0.0 0.0 0.0 0.0 (1, 1) 0.655102040816 0.415199123128 0.545659444525 0.475098564895 0.513802739222 l1 is 2, l2 is 3 Exact values (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 334 3017 13806 81410 362384 (0, 1) 171 2493 11844 75789 347742 (0, 2) 171 2493 11844 75789 347742 (1, 0) 330 1470 13800 66648 362364 (1, 1) 477 2106 15615 72117 377784 (1, 2) 477 2106 15615 72117 377784 Proportions (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 0.170408163265 0.220460358056 0.167296786389 0.183409556852 0.166552072801 (0, 1) 0.0872448979592 0.182170259408 0.143521884543 0.170745939126 0.159822593988 (0, 2) 0.0872448979592 0.182170259408 0.143521884543 0.170745939126 0.159822593988 (1, 0) 0.168367346939 0.107416879795 0.167224080268 0.150152071552 0.166542880779 (1, 1) 0.243367346939 0.153891121666 0.189217682129 0.162473246671 0.173629929221 (1, 2) 0.243367346939 0.153891121666 0.189217682129 0.162473246671 0.173629929221 l1 is 3, l2 is 2 Exact values (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 334 3017 13806 81410 362384 (0, 1) 330 1470 13800 66648 362364 (1, 0) 171 2493 11844 75789 347742 (1, 1) 477 2106 15615 72117 377784 (2, 0) 171 2493 11844 75789 347742 (2, 1) 477 2106 15615 72117 377784 Proportions (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 0.170408163265 0.220460358056 0.167296786389 0.183409556852 0.166552072801 (0, 1) 0.168367346939 0.107416879795 0.167224080268 0.150152071552 0.166542880779 (1, 0) 0.0872448979592 0.182170259408 0.143521884543 0.170745939126 0.159822593988 (1, 1) 0.243367346939 0.153891121666 0.189217682129 0.162473246671 0.173629929221 (2, 0) 0.0872448979592 0.182170259408 0.143521884543 0.170745939126 0.159822593988 (2, 1) 0.243367346939 0.153891121666 0.189217682129 0.162473246671 0.173629929221 l1 is 3, l2 is 3 Exact values (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 512 3223 18746 95490 445900 (0, 1) 76 632 4430 26284 139424 (0, 2) 76 632 4430 26284 139424 (1, 0) 76 632 4430 26284 139424 (1, 1) 76 657 4385 26266 139614 (1, 2) 496 3310 18644 95356 446488 (2, 0) 76 632 4430 26284 139424 (2, 1) 496 3310 18644 95356 446488 (2, 2) 76 657 4385 26266 139614 Proportions (r1,r2) n=3 n=4 n=5 n=6 n=7 (0, 0) 0.261224489796 0.235513335769 0.22715816005 0.215130556244 0.204936115452 (0, 1) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 (0, 2) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 (1, 0) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 (1, 1) 0.0387755102041 0.0480087687249 0.0531360573894 0.0591749836664 0.0641667432668 (1, 2) 0.25306122449 0.241870661308 0.225922155979 0.214828666051 0.205206360879 (2, 0) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 (2, 1) 0.25306122449 0.241870661308 0.225922155979 0.214828666051 0.205206360879 (2, 2) 0.0387755102041 0.0480087687249 0.0531360573894 0.0591749836664 0.0641667432668

        
(r1,r2) n=0 n=1 n=2 n=3 n=4 n=5 n=6 n=7 (0, 0) 0 2 24 104 456 1782 6402 21336 (0, 1) 0 -3 -12 -75 -342 -1362 -4977 -16839 (0, 2) 0 0 3 23 106 479 1781 6171 (0, 3) 0 0 3 23 106 479 1781 6171 (0, 4) 0 -3 -12 -75 -342 -1362 -4977 -16839 (1, 0) 0 -3 -12 -75 -342 -1362 -4977 -16839 (1, 1) 0 1 12 63 293 1243 4653 16101 (1, 2) 0 0 -3 -24 -141 -621 -2505 -9089 (1, 3) 0 0 0 -6 -31 -100 -289 -649 (1, 4) 0 0 9 42 205 852 3129 10476 (2, 0) 0 0 3 23 106 479 1781 6171 (2, 1) 0 0 -3 -24 -141 -621 -2505 -9089 (2, 2) 0 0 1 13 94 488 2131 8191 (2, 3) 0 0 0 -6 -39 -234 -1106 -4624 (2, 4) 0 0 0 -6 -31 -100 -289 -649 (3, 0) 0 0 3 23 106 479 1781 6171 (3, 1) 0 0 0 -6 -31 -100 -289 -649 (3, 2) 0 0 0 -6 -39 -234 -1106 -4624 (3, 3) 0 0 1 13 94 488 2131 8191 (3, 4) 0 0 -3 -24 -141 -621 -2505 -9089 (4, 0) 0 -3 -12 -75 -342 -1362 -4977 -16839 (4, 1) 0 0 9 42 205 852 3129 10476 (4, 2) 0 0 0 -6 -31 -100 -289 -649 (4, 3) 0 0 -3 -24 -141 -621 -2505 -9089 (4, 4) 0 1 12 63 293 1243 4653 16101


q^-1 + 24 + 324*q + 3200*q^2 + 25650*q^3 + 176256*q^4 + 1073720*q^5 + 5930496*q^6 + 30178575*q^7 + O(q^8)
#Produces tables that indicase distributions of gamma_S(r1,l1,r2,l2,n) for varying r1 and r2
#first prime ranges from l1start to l1stop, second prime ranges from l2start to l2stop
#lists n from N0 to N in table. probably limit range to 10 for the sake of visualization
#For N greater than 20, this will take more than a few minutes. for N around 30, this might take around 15 minutes. 
def Cstatistic(l1start,l1stop,N0,N,h10,h20,h11):
    print "Hodge numbers are {}, {}, and {}. Euler is {} and other is {}.".format(h10,h20,h11,2-4*h10+2*h20+h11, 1-2*h10+h20)

    def generatingFunctionWithPrecision(M):

        def numerator(NN):
            return prod(((1-x*q^n)*(1-x^(-1)*q^n)*(1-y*q^n)*(1-y^(-1)*q^n))^h10 for n in range (1,NN))

        def Denominator1(NN):
            return prod((sum((x*y*q^n)^k for k in range(0,NN))) for n in range(1,NN))
    
        def Denominator2(NN):
            return prod((sum((x^(-1)*y^(-1)*q^n)^k for k in range(0,NN))) for n in range(1,NN))

        def Denominator3(NN):
            if h20 == 0:
                return 1
            else:
                return prod((sum(binomial(k,h20-1)*(x^(-1)*y*q^n)^(k-h20+1) for k in range(h20-1,NN+h20-1))) for n in range(1,NN))
    
        def Denominator4(NN):
            if h20 == 0:
                return 1
            else:
                return prod((sum(binomial(k,h20-1)*(x*y^(-1)*q^n)^(k-h20+1) for k in range(h20-1,NN+h20-1))) for n in range(1,NN))

        def Denominator5(NN):
            if h11 == 0:
                return 1
            else:
                return prod((sum(binomial(k,h11-1)*(q^n)^(k-h11+1) for k in range(h11-1,NN+h11-1))) for n in range(1,NN))

        def genFxnHelper(NN):
            return numerator(NN) * Denominator1(NN) * Denominator2(NN) * Denominator3(NN) * Denominator4(NN) * Denominator5(NN)
    
        def genFxnUpTo(NN):
            return taylor(genFxnHelper(NN),q,0,NN)
        
        


        theFxn = genFxnUpTo(M+1)

        lstOfDumbCoeffs = [(k,theFxn.coefficient(q^k)) for k in range(1,M+1)]
        return lstOfDumbCoeffs
    
    theFxn = generatingFunctionWithPrecision(2*N)
    
    def Cfunction(r1,l1,r2,l2):

        def ComputeMatrix(m,theFxn1):
            #print "m={}".format(m)
            #print len(theFxn1)

            scaledFxn = x^m*y^m*theFxn1[m-1][1]
            #print "scaledFxn is {}".format(scaledFxn)

            # creates 2m+1 x 2m+1 list of zeros
            matrix = []
            for i in range(0,2*m+1):
                matrix.append([])
                for j in range(0,2*m+1):
                    matrix[i].append(0)

            # top left quadrant
            for i in range(0,m+1):
                for j in range(0,m+1):
                    matrix[i][j] = scaledFxn.coefficient(x^(i+m)*y^(j+m)).coefficient(x,0).coefficient(y,0)

            # top right quadrant
            for i in range(0,m+1):
                for j in range(m+1,2*m+1):
                    matrix[i][j] = scaledFxn.coefficient(x^(i+m)*y^(j-(m+1))).coefficient(x,0).coefficient(y,0)

            # bottom left quadrant
            for i in range(m+1,2*m+1):
                for j in range(0,m+1):
                    matrix[i][j] = scaledFxn.coefficient(x^(i-m-1)*y^(j+m)).coefficient(x,0).coefficient(y,0)

            # bottom right quadrant
            for i in range(m+1,2*m+1):
                for j in range(m+1,2*m+1):
                    matrix[i][j] = scaledFxn.coefficient(x,(i-m-1)).coefficient(y,(j-m-1))
    
            return matrix

        def natefunction(m):

            matrix = ComputeMatrix(m,theFxn)

            sum = 0
        
        
            for n in range(-m,m+1):
                if (n % l1) == r1:
                    for t in range(-m,m+1):
                        if (t % l2) == r2:
                            #print "about to input ({},{})".format(n,t)
                            #print "matrix size is {}".format(len(matrix))
                            sum = sum + matrix[n][t]
                        
        

            return sum
    
        lst = []
        for n in range(0,N+1):
            lst.append(natefunction(n))
        return lst
    
    for l1 in range(l1start,l1stop):
        if l1 in [1,Primes()]:
            print "l1 is {}".format(l1)
            
    
            header= ["(r1,r2)"]
    
            for n in range(N0,N+1):
                header.append("n={}".format(n))
            
            rows = [header]
    

            for a in range(0,l1):
                for b in range(0,l1):
                    lst = [(a,b)]
                    for n in range(N0,N+1):
                        lst.append(Cfunction(a,l1,b,l1)[n])
                    rows.append(lst)
                
    
            #return table(rows)

            print
            
            print "Exact values"
            
            print table(rows)
            
            print
    
            #stats = rows
   
            total = []
    
            for a in range(0,N+1-N0):
                colsum = 0
                for t in range(1,l1*l1+1):
                    colsum = colsum + rows[t][a+1]
                total.append(colsum)
    
            for a in range(0,N+1-N0):
                #total = 0
                #for t in range(1,l1*l2+1):
                    #total = total + rows[t][a+1]
                #print total
                for b in range(0,l1*l1):
                    if total[a] == 0:
                        rows[b+1][a+1] = "N/A"
                    else:
                        rows[b+1][a+1] = float(rows[b+1][a+1] / total[a])
    
            print "Proportions"
        
            print table(rows)
   

Cstatistic(2,6,3,10,0,8,2)
Hodge numbers are 0, 8, and 2. Euler is 20 and other is 9. l1 is 2 Exact values (r1,r2) n=3 n=4 n=5 n=6 n=7 n=8 n=9 n=10 (0, 0) 676 8003 37494 232988 1057868 5011454 20769234 84432304 (0, 1) 0 0 0 0 0 0 0 0 (1, 0) 0 0 0 0 0 0 0 0 (1, 1) 1284 5682 45030 210882 1117932 4858536 21138146 83580520 Proportions (r1,r2) n=3 n=4 n=5 n=6 n=7 n=8 n=9 n=10 (0, 0) 0.344897959184 0.584800876872 0.454340555475 0.524901435105 0.486197260778 0.507746613725 0.495598484086 0.502534877933 (0, 1) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 (1, 0) 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 (1, 1) 0.655102040816 0.415199123128 0.545659444525 0.475098564895 0.513802739222 0.492253386275 0.504401515914 0.497465122067 l1 is 3 Exact values (r1,r2) n=3 n=4 n=5 n=6 n=7 n=8 n=9 n=10 (0, 0) 512 3223 18746 95490 445900 1940758 7926104 30666624 (0, 1) 76 632 4430 26284 139424 674918 3021783 12667504 (0, 2) 76 632 4430 26284 139424 674918 3021783 12667504 (1, 0) 76 632 4430 26284 139424 674918 3021783 12667504 (1, 1) 76 657 4385 26266 139614 674641 3021666 12668522 (1, 2) 496 3310 18644 95356 446488 1940139 7925406 30669570 (2, 0) 76 632 4430 26284 139424 674918 3021783 12667504 (2, 1) 496 3310 18644 95356 446488 1940139 7925406 30669570 (2, 2) 76 657 4385 26266 139614 674641 3021666 12668522 Proportions (r1,r2) n=3 n=4 n=5 n=6 n=7 n=8 n=9 n=10 (0, 0) 0.261224489796 0.235513335769 0.22715816005 0.215130556244 0.204936115452 0.196632215433 0.189133847069 0.182525495792 (0, 1) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 0.0683808190282 0.0721062256815 0.0753960542917 (0, 2) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 0.0683808190282 0.0721062256815 0.0753960542917 (1, 0) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 0.0683808190282 0.0721062256815 0.0753960542917 (1, 1) 0.0387755102041 0.0480087687249 0.0531360573894 0.0591749836664 0.0641667432668 0.0683527541568 0.0721034338105 0.075402113353 (1, 2) 0.25306122449 0.241870661308 0.225922155979 0.214828666051 0.205206360879 0.19656950007 0.189117191292 0.182543030168 (2, 0) 0.0387755102041 0.0461819510413 0.0536813533033 0.0592155360804 0.0640794190643 0.0683808190282 0.0721062256815 0.0753960542917 (2, 1) 0.25306122449 0.241870661308 0.225922155979 0.214828666051 0.205206360879 0.19656950007 0.189117191292 0.182543030168 (2, 2) 0.0387755102041 0.0480087687249 0.0531360573894 0.0591749836664 0.0641667432668 0.0683527541568 0.0721034338105 0.075402113353 l1 is 5 Exact values (r1,r2) n=3 n=4 n=5 n=6 n=7 n=8 n=9 n=10 (0, 0) 270 2161 11160 57178 264154 1139480 4619930 17741540 (0, 1) 0 36 328 2552 15652 84684 413672 1864059 (0, 2) 32 392 2282 13590 70126 333234 1468596 6068560 (0, 3) 32 392 2282 13590 70126 333234 1468596 6068560 (0, 4) 0 36 328 2552 15652 84684 413672 1864059 (1, 0) 0 36 328 2552 15652 84684 413672 1864059 (1, 1) 73 343 2503 13659 70760 334495 1471055 6074478 (1, 2) 36 292 2224 13136 69324 331284 1464143 6059625 (1, 3) 8 40 432 2706 16264 85982 416862 1871036 (1, 4) 360 1890 11316 56576 263540 1138068 4616236 17735160 (2, 0) 32 392 2282 13590 70126 333234 1468596 6068560 (2, 1) 36 292 2224 13136 69324 331284 1464143 6059625 (2, 2) 4 77 419 2919 16503 86913 418754 1875386 (2, 3) 256 1932 10912 56224 262288 1135411 4611134 17724058 (2, 4) 8 40 432 2706 16264 85982 416862 1871036 (3, 0) 32 392 2282 13590 70126 333234 1468596 6068560 (3, 1) 8 40 432 2706 16264 85982 416862 1871036 (3, 2) 256 1932 10912 56224 262288 1135411 4611134 17724058 (3, 3) 4 77 419 2919 16503 86913 418754 1875386 (3, 4) 36 292 2224 13136 69324 331284 1464143 6059625 (4, 0) 0 36 328 2552 15652 84684 413672 1864059 (4, 1) 360 1890 11316 56576 263540 1138068 4616236 17735160 (4, 2) 8 40 432 2706 16264 85982 416862 1871036 (4, 3) 36 292 2224 13136 69324 331284 1464143 6059625 (4, 4) 73 343 2503 13659 70760 334495 1471055 6074478 Proportions (r1,r2) n=3 n=4 n=5 n=6 n=7 n=8 n=9 n=10 (0, 0) 0.137755102041 0.15791012057 0.135233386651 0.128816995967 0.121405460061 0.115448951823 0.110241441961 0.105596344241 (0, 1) 0.0 0.00263061746438 0.0039746013281 0.00574943113975 0.00719367588933 0.00857994790268 0.00987110146232 0.011094742387 (0, 2) 0.0163265306122 0.0286445012788 0.027652561679 0.0306170725663 0.0322299843736 0.0337623442374 0.0350438514648 0.0361196238211 (0, 3) 0.0163265306122 0.0286445012788 0.027652561679 0.0306170725663 0.0322299843736 0.0337623442374 0.0350438514648 0.0361196238211 (0, 4) 0.0 0.00263061746438 0.0039746013281 0.00574943113975 0.00719367588933 0.00857994790268 0.00987110146232 0.011094742387 (1, 0) 0.0 0.00263061746438 0.0039746013281 0.00574943113975 0.00719367588933 0.00857994790268 0.00987110146232 0.011094742387 (1, 1) 0.0372448979592 0.0250639386189 0.0303305705007 0.0307725234866 0.0325213714496 0.0338901052585 0.0351025284807 0.0361548473228 (1, 2) 0.0183673469388 0.0213372305444 0.0269497358344 0.0295942505689 0.0318613843184 0.0335647756482 0.0349375933308 0.0360664433567 (1, 3) 0.00408163265306 0.00292290829375 0.00523484077359 0.00609637957059 0.00747495174189 0.00871145766105 0.00994722170653 0.0111362689791 (1, 4) 0.183673469388 0.13810741688 0.137123745819 0.12746074301 0.121123265006 0.115305891901 0.110153295195 0.105558370949 (2, 0) 0.0163265306122 0.0286445012788 0.027652561679 0.0306170725663 0.0322299843736 0.0337623442374 0.0350438514648 0.0361196238211 (2, 1) 0.0183673469388 0.0213372305444 0.0269497358344 0.0295942505689 0.0318613843184 0.0335647756482 0.0349375933308 0.0360664433567 (2, 2) 0.00204081632653 0.00562659846547 0.00507731084291 0.00657624980287 0.00758479639673 0.00880578399775 0.00999236888586 0.0111621598599 (2, 3) 0.130612244898 0.141176470588 0.132228200281 0.126667718026 0.120547844471 0.115036692033 0.110031550529 0.10549229266 (2, 4) 0.00408163265306 0.00292290829375 0.00523484077359 0.00609637957059 0.00747495174189 0.00871145766105 0.00994722170653 0.0111362689791 (3, 0) 0.0163265306122 0.0286445012788 0.027652561679 0.0306170725663 0.0322299843736 0.0337623442374 0.0350438514648 0.0361196238211 (3, 1) 0.00408163265306 0.00292290829375 0.00523484077359 0.00609637957059 0.00747495174189 0.00871145766105 0.00994722170653 0.0111362689791 (3, 2) 0.130612244898 0.141176470588 0.132228200281 0.126667718026 0.120547844471 0.115036692033 0.110031550529 0.10549229266 (3, 3) 0.00204081632653 0.00562659846547 0.00507731084291 0.00657624980287 0.00758479639673 0.00880578399775 0.00999236888586 0.0111621598599 (3, 4) 0.0183673469388 0.0213372305444 0.0269497358344 0.0295942505689 0.0318613843184 0.0335647756482 0.0349375933308 0.0360664433567 (4, 0) 0.0 0.00263061746438 0.0039746013281 0.00574943113975 0.00719367588933 0.00857994790268 0.00987110146232 0.011094742387 (4, 1) 0.183673469388 0.13810741688 0.137123745819 0.12746074301 0.121123265006 0.115305891901 0.110153295195 0.105558370949 (4, 2) 0.00408163265306 0.00292290829375 0.00523484077359 0.00609637957059 0.00747495174189 0.00871145766105 0.00994722170653 0.0111362689791 (4, 3) 0.0183673469388 0.0213372305444 0.0269497358344 0.0295942505689 0.0318613843184 0.0335647756482 0.0349375933308 0.0360664433567 (4, 4) 0.0372448979592 0.0250639386189 0.0303305705007 0.0307725234866 0.0325213714496 0.0338901052585 0.0351025284807 0.0361548473228
 1 in [1,0]
True
[1,Primes(4)]    
[1, Set of all prime numbers: 2, 3, 5, 7, ...]
2 in Primes(4)
True
def OnePrimes(n):
    lst = [1]
    for i in range(2,n+1):
        if i in Primes():
            lst.append(i)
    return lst
OnePrimes(10)
[1, 2, 3, 5, 7]
  2 in OnePrimes(10)  
True