CoCalc Public Fileswww / talks / ants6 / disc.py
Author: William A. Stein
1import arith, math
2
3
4def conj(p,k):
5    """
6    Returns the conjectural valuation at p of the
7    index of the Hecke algebra T_k(Gamma_0(p)) in
8    its normalization.
9
10    INPUTS:
11       p -- a prime integer
12       k -- an even integer >= 2.
13
14    OUTPUT:
15       an integer
16    """
17    assert isinstance(p,int), "Argument 1 must be an int."
18    assert isinstance(k,int), "Argument 1 must be an int."
19    assert arith.is_prime(p), "Argument 1 must be prime."
20    assert k%2==0, "Argument 2 must be even."
21
22    return int(math.floor(p/12)*arith.binom(k/2,2) + a(p,k))
23
24def a(p,k):
25    """
26    Function a(p,k) involved in the conjectural formula
27    returned by the conj function.
28
29    INPUTS:
30       p -- a prime integer
31       k -- an even integer >= 2.
32
33    OUTPUT:
34       an integer
35    """
36    assert isinstance(p,int), "Argument 1 must be an int."
37    assert isinstance(k,int), "Argument 1 must be an int."
38    assert arith.is_prime(p), "Argument 1 must be prime."
39
40    pmod = p % 12
41    if pmod==1:
42        return 0
43    elif pmod==5:
44        return 3*arith.binom(int(math.ceil(k/6.0)),2)
45    elif pmod==7:
46        return 2*arith.binom(int(math.ceil(k/4.0)),2)
47    else:
48        return a(5,k) + a(7,k)
49
50