For positive integers we say that the triple is \emph{cyclically divisible} if
are all integers.
Let be the set of all cyclically divisible ordered triples of positive integers. For any positive integer , define
and the arithmetic function by
For arithmetic functions , define their \emph{divisor-sum combination} by
and let denote the constant function .
It is known that the set is finite. Moreover, there exists an arithmetic function
depending only on the values of for , such that
Let
and define the integer
Set
the exponent of in the prime factorization of .
Using the above information, determine the exact value of the integer .
[THOUGHT] We need to find E = v_2(K) where K = ∏_{n=1}^{N} (n!)^{F(n)} and N = 10^7.
First, v_2(K) = ∑_{n=1}^{N} F(n) * v_2(n!).
We know v_2(n!) = n - s_2(n) where s_2(n) is the sum of binary digits of n (Legendre's formula: v_p(n!) = (n - s_p(n))/(p-1) for p=2 gives v_2(n!) = n - s_2(n)).
Thus E = ∑_{n=1}^{N} F(n) * (n - s_2(n)).
But F(n) = ∑{d|n} G(d). So E = ∑{n=1}^{N} (∑_{d|n} G(d)) * (n - s_2(n)).
Swap sums: E = ∑{d=1}^{N} G(d) * ∑{n: d|n, n≤N} (n - s_2(n)).
Let M = N = 10^7. For each d, sum over multiples n = d*k with k ≤ N/d.
So ∑{n: d|n, n≤N} (n - s_2(n)) = ∑{k=1}^{⌊N/d⌋} (dk - s_2(dk)).
Thus E = ∑{d=1}^{N} G(d) * ( d * ∑{k=1}^{⌊N/d⌋} k - ∑_{k=1}^{⌊N/d⌋} s_2(d*k) ).
We need to know G(d). G(d) is defined based on the finite set T of cyclically divisible triples (a,b,c). G(d) depends only on S(a,b,c). Specifically, G(d) = number of triples (a,b,c) in T such that S(a,b,c) = d? Wait: F(n) counts triples with S(a,b,c) dividing n. So G(d) should be the number of triples with S(a,b,c) = d? Because if F(n) = ∑{d|n} G(d), then G is the inverse Möbius transform: G(d) = ∑{k|d} μ(k) F(d/k). But they say G depends only on the values of S(a,b,c) for (a,b,c)∈T. Since T is finite, the set of possible sums S(a,b,c) is finite. Let D be the set of distinct sums d = S(a,b,c) for (a,b,c)∈T. Then G(d) = number of triples with sum exactly d. Because F(n) = number of triples with sum dividing n = ∑_{d|n} (number of triples with sum = d). Yes.
Thus we need to find all cyclically divisible triples (a,b,c) positive integers, compute their sums d = a+b+c, and count multiplicities: G(d) = number of triples with that sum.
Then compute E = ∑{d=1}^{N} G(d) * ( d * ∑{k=1}^{⌊N/d⌋} k - ∑_{k=1}^{⌊N/d⌋} s_2(d*k) ).
But N is huge (10^7). However, T is finite, so only finitely many d have nonzero G(d). So we can compute E by iterating over those d.
We need to find all cyclically divisible triples. Conditions: (a+1)/b integer, (b+1)/c integer, (c+1)/a integer.
Let x = (a+1)/b, y = (b+1)/c, z = (c+1)/a, all positive integers.
Then a = zx - 1? Wait: from z = (c+1)/a => c = az - 1. From y = (b+1)/c => b = cy - 1 = (az - 1)y - 1 = azy - y - 1. From x = (a+1)/b => a+1 = bx = (azy - y - 1)x => a+1 = azyx - x*y - x.
Thus a+1 = azyx - xy - x => bring a terms: a+1 = a*(xyz) - x*y - x.
So a*(xyz) - a = xy + x + 1? Wait: a+1 = a(xyz) - xy - x => a+1 = a(xyz) - xy - x => bring a: a+1 + xy + x = a*(xyz) => a*(xyz) = a + 1 + xy + x = a + xy + x + 1.
Thus a*(xyz - 1) = x*y + x + 1.
Similarly symmetric equations for b and c.
But maybe easier: brute force search for small a,b,c? Since T is finite, maybe there are only few triples. Let's try to find all solutions.
We can search for a,b,c up to some bound? Not given bound. But maybe the equations force small values.
Let's try to find all positive integer solutions to (a+1)/b integer, etc.
We can write a+1 = bu, b+1 = cv, c+1 = a*w, where u,v,w positive integers.
Then a = bu - 1, b = cv - 1, c = a*w - 1.
Substitute: b = (aw - 1)v - 1 = awv - v - 1. But also a = bu - 1 => a = (awv - v - 1)u - 1 = awvu - uv - u - 1.
Thus a = awvu - uv - u - 1 => a*(wvu - 1) = u*v + u + 1.
So a = (uv + u + 1)/(wv*u - 1). Similarly symmetric.
Since a,b,c positive integers, we can search over u,v,w small.
But maybe easier: brute force search for a,b,c up to some limit, say 1000, and see if any solutions exist.
Let's do that with Python.
We'll search for (a,b,c) positive integers such that (a+1)%b==0, (b+1)%c==0, (c+1)%a==0.
We'll search up to maybe 1000 each dimension? That's 10^9 combos, too big. But we can use symmetry? Not symmetric because conditions cyclic.
We can reduce search: For each a, b divides a+1, so b ≤ a+1. Similarly c ≤ b+1, a ≤ c+1. So each is at most one more than previous. So we can iterate a up to some bound, then b divides a+1, so b ∈ divisors(a+1). Then c divides b+1, etc. That's manageable.
Let's search for a up to maybe 10000? But we need to find all solutions. Since T is finite, maybe there are only a few.
Let's implement.
We'll collect all triples (a,b,c) positive integers satisfying conditions.
We'll also compute sums.
Then compute G(d) = count of triples with sum d.
Then compute E as described.
But N = 10^7, and d's are small (maybe up to few thousand). So we can compute E directly.
Let's code. </think>
[PYTHON] import math from collections import Counter
Find all cyclically divisible triples (a,b,c) with a,b,c positive integers.
Use condition: b | (a+1), c | (b+1), a | (c+1).
We'll search a up to some bound. Since each divides previous+1, values are bounded.
We'll search a from 1 to maybe 10000, but let's see.
max_a = 10000 triples = []
for a in range(1, max_a+1): # b must divide a+1 for b in range(1, a+2): # b ≤ a+1 if (a+1) % b != 0: continue # c must divide b+1 for c in range(1, b+2): # c ≤ b+1 if (b+1) % c != 0: continue # a must divide c+1 if (c+1) % a != 0: continue triples.append((a,b,c))
print("Number of triples found:", len(triples)) if triples: print("First few triples:", triples[:10]) # Compute sums sums = [a+b+c for a,b,c in triples] G = Counter(sums) print("Distinct sums and counts:", G) else: print("No triples found.")
Let's verify if any triple with a,b,c > 10000 exists? But bound may be enough.
We'll increase max_a to maybe 100000 to be safe, but careful about loops.
Actually, since b ≤ a+1, c ≤ b+1 ≤ a+2, a ≤ c+1 ≤ b+2 ≤ a+3, so a,b,c are close.
So a up to 100000 is fine.
max_a2 = 100000 triples2 = []
Use divisors to reduce search
for a in range(1, max_a2+1): # b divides a+1 # iterate over divisors of a+1 a1 = a+1 # generate divisors divisors = [] for i in range(1, int(math.isqrt(a1))+1): if a1 % i == 0: divisors.append(i) if i != a1//i: divisors.append(a1//i) for b in divisors: # c divides b+1 b1 = b+1 divisors2 = [] for i in range(1, int(math.isqrt(b1))+1): if b1 % i == 0: divisors2.append(i) if i != b1//i: divisors2.append(b1//i) for c in divisors2: if (c+1) % a != 0: continue triples2.append((a,b,c))
print("\nWith max_a=100000, number of triples:", len(triples2)) if triples2: sums2 = [a+b+c for a,b,c in triples2] G2 = Counter(sums2) print("Distinct sums and counts (first few):", dict(list(G2.items())[:20])) else: print("No triples found.")
Check if any triple beyond 100000 exists. Since a,b,c are close, maybe there are none.
Let's analyze theoretically: from equations a+1 = bu, b+1 = cv, c+1 = a*w.
Then a = (uv + u + 1)/(wv*u - 1). For large a, denominator must be small.
So wvu - 1 must divide u*v + u + 1. For large u,v,w, denominator grows, so likely only small solutions.
So search up to 100000 should be enough.
We'll trust G2 as the correct G.
But we need to compute E = v_2(K) = sum_{d} G(d) * ( d * sum_{k=1}^{M//d} k - sum_{k=1}^{M//d} s_2(d*k) )
where M = 10^7.
M = 10_000_000
Precompute s_2 for numbers up to M? Too large. But we need sum_{k=1}^{t} s_2(d*k) for each d.
Since d is small (maybe up to few thousand), we can compute sum_{k=1}^{t} s_2(d*k) by iterating k up to t = M//d.
But t could be large (up to M). However, d small, so t large. We need efficient computation.
We can use formula: sum_{k=1}^{t} s_2(dk) = sum_{k=1}^{t} s_2(kd). There is known formula for sum of binary digits over arithmetic progression?
Maybe we can compute using digit DP? But t up to 10^7/d, and d small, so t up to 10^7.
But we have to do this for each d with nonzero G(d). Number of such d is small (maybe < 10). So we can afford O(t) per d.
Let's compute for each d in G2.
def sum_s2(t): # sum_{k=1}^{t} s_2(k) # Use known formula: sum_{k=0}^{t-1} s_2(k) = (t-1)log2(t) something? Not trivial. # We'll compute iteratively for t up to maybe 10^7? That's okay for a few d. # But we need sum_{k=1}^{t} s_2(dk). We can compute by iterating k and computing s_2(dk). # For t up to 10^7, iterating 10^7 times per d is okay if d count small. # However, t = M//d could be up to 10^7 for d=1. That's 10^7 iterations, fine. # Let's implement a function to compute sum of s_2(dk) for k=1..t. total = 0 for k in range(1, t+1): total += bin(d*k).count('1') return total
But we need also sum_{k=1}^{t} k = t*(t+1)//2.
Let's compute E using G2.
E = 0 for d, cnt in G2.items(): t = M // d sum_k = t * (t + 1) // 2 sum_s2_dk = sum_s2(t) # but sum_s2 defined as sum_{k=1}^{t} s_2(kd) not s_2(k). # Actually we need sum_{k=1}^{t} s_2(dk). So we need to compute for each d separately. # Let's compute directly. sum_s2_dk = 0 for k in range(1, t+1): sum_s2_dk += bin(d*k).count('1') contrib = d * sum_k - sum_s2_dk E += cnt * contrib
print("E computed directly:", E)
But this loop may be slow if t large. Let's optimize sum_s2(d*k) using known formula? Not trivial.
However, we can compute sum_{k=1}^{t} s_2(dk) by iterating k and computing binary digit sum of dk.
For d=1, t=10^7, we need to compute 10^7 binary digit sums. That's okay in Python? Might be a few seconds.
Let's test with a small example first.
We'll compute for d=1, t=1000 to see if it works.
def sum_s2_dtimes_dk(d, t): total = 0 for k in range(1, t+1): total += bin(d*k).count('1') return total
Test
print("Test sum_s2_dtimes_dk(1, 1000):", sum_s2_dtimes_dk(1, 1000))
Now compute E with optimized loops? We'll compute for each d in G2.
But we need to ensure we don't miss any d. Let's list G2 items.
print("\nG2 items:", G2.items())
Let's compute E using a more clever method: sum_{k=1}^{t} s_2(d*k) = sum_{k=1}^{t} s_2(k) if d is odd? Not exactly.
However, note that v_2(K) = sum_{n=1}^{M} F(n) * (n - s_2(n)).
And F(n) = sum_{d|n} G(d). So E = sum_{n=1}^{M} (sum_{d|n} G(d)) * (n - s_2(n)).
Swap sums: E = sum_{d=1}^{M} G(d) * sum_{m=1}^{M//d} (dm - s_2(dm)).
That's what we have.
Since G(d) nonzero only for few d, we can compute.
Let's compute with d up to maybe 1000? But we need to ensure we have all d.
Let's find max sum from our triples.
max_sum = max(sums2) if sums2 else 0 print("Maximum sum among triples:", max_sum)
So d <= max_sum. Let's compute E directly using that.
We'll compute sum_{k=1}^{t} s_2(dk) efficiently using precomputed s_2 for numbers up to dt? But dt up to d(M//d) ≈ M. So we need s_2 for numbers up to M, which is 10^7. That's large but maybe manageable if we precompute array of size M+1? 10^7 integers is ~40 MB, okay.
Precompute s_2 for all numbers up to M.
But we also need s_2(d*k) for each d. Since d varies, we could compute on the fly.
Let's precompute s_2 for numbers up to M using dynamic programming: s_2(i) = s_2(i>>1) + (i&1).
Then sum_{k=1}^{t} s_2(d*k) = sum_{j=d,2d,...,dt} s_2(j). So we can sum over j in arithmetic progression.
However, precomputing s_2 up to M is fine.
print("Precomputing s_2 up to M...")
We'll compute s_2 for numbers 0..M inclusive.
Use list of ints.
M = 10_000_000 s2 = [0] * (M+1) for i in range(1, M+1): s2[i] = s2[i>>1] + (i&1) print("s2 precomputed.")
Now compute sum_s2_dtimes_dk(d, t) using precomputed s2.
def sum_s2_dtimes_dk_fast(d, t): total = 0 for k in range(1, t+1): total += s2[d*k] return total
But iterating k up to t could be large for d=1 (t=10^7). That's 10^7 iterations, okay.
Let's compute E with this.
E2 = 0 for d, cnt in G2.items(): t = M // d sum_k = t * (t + 1) // 2 sum_s2_dk = sum_s2_dtimes_dk_fast(d, t) contrib = d * sum_k - sum_s2_dk E2 += cnt * contrib
print("E computed with precomputed s2:", E2)
Ensure E2 equals previous E (if we computed correctly). We'll recompute previous E with same method.
But we didn't compute previous E with precomputed s2. Let's recompute.
E3 = 0 for d, cnt in G2.items(): t = M // d sum_k = t * (t + 1) // 2 sum_s2_dk = 0 for k in range(1, t+1): sum_s2_dk += s2[d*k] contrib = d * sum_k - sum_s2_dk E3 += cnt * contrib
print("E recomputed:", E3)
Now we need to verify G2 is correct. Let's double-check triples by brute force with a smaller bound and also verify conditions.
Let's also check if there is any triple with a,b,c beyond 100000. We'll analyze equations.
From earlier equations: a*(xyz - 1) = x*y + x + 1, where x = (a+1)/b, y = (b+1)/c, z = (c+1)/a are positive integers.
So xyz - 1 divides x*y + x + 1.
Similarly symmetric equations. This suggests x,y,z are small.
Let's search for x,y,z up to maybe 10 and compute a.
We'll do that to confirm all triples.
triples_xy = [] max_xyz = 10 for x in range(1, max_xyz+1): for y in range(1, max_xyz+1): for z in range(1, max_xyz+1): denom = xyz - 1 if denom == 0: continue num = x*y + x + 1 if num % denom == 0: a = num // denom # Now compute b = (a+1)/x, c = (b+1)/y, check c+1 divisible by a. b = (a+1) // x c = (b+1) // y if (c+1) % a == 0: triples_xy.append((a,b,c)) print("\nTriples from x,y,z up to", max_xyz, ":", triples_xy)
Compare with earlier triples.
print("Triples from earlier search (a up to 100000) count:", len(triples2))
Check if all triples from x,y,z search are in triples2.
for t in triples_xy: if t not in triples2: print("Triple not in earlier search:", t)
Also check if earlier search found any extra.
for t in triples2: if t not in triples_xy: print("Extra triple found:", t) # But maybe x,y,z >10? Let's increase max_xyz.
However, our earlier search used condition directly, so it's exhaustive up to a=100000.
If there are any triples with a>100000, they would be missed. But maybe not.
Let's increase max_xyz to 100 to be safe.
print("\nSearching x,y,z up to 100...") triples_xy2 = [] for x in range(1, 101): for y in range(1, 101): for z in range(1, 101): denom = xyz - 1 if denom == 0: continue num = x*y + x + 1 if num % denom == 0: a = num // denom b = (a+1) // x c = (b+1) // y if (c+1) % a == 0: triples_xy2.append((a,b,c)) print("Triples from x,y,z up to 100:", triples_xy2)
Check if any new triples beyond earlier.
for t in triples_xy2: if t not in triples2: print("New triple with x,y,z up to 100:", t) # Let's see sum print("Sum:", sum(t))
Likely no new triples. So triples2 is complete.
Now we have G2. Let's compute E more efficiently.
Instead of iterating k up to t for each d, we can compute sum_{k=1}^{t} s_2(d*k) using digit DP for arithmetic progression? Not needed if t up to 10^7 and d small.
But we have only a few d. Let's list d values: from G2.
print("\nDistinct sums d with counts:", G2.items())
Let's compute E using fast method with precomputed s2.
We'll compute sum_s2_dk using list comprehension? Might be memory heavy.
But we can compute by iterating k and using s2 array.
Since t up to 10^7 for d=1, but d=1 likely not in G2? Check G2: sums are maybe small.
Let's see.
Actually, from our earlier triple search, sums are small. Let's print them.
print("\nAll sums (with multiplicities):") for d in sorted(G2.keys()): print(f"d={d}: count={G2[d]}")
So d are small (maybe up to few hundred). So t = M//d is large (up to 10^7). But we have only a few d, so total iterations sum_{d} t = sum_{d} M//d. Since d small, M//d ~ M/d, sum of 1/d over d small diverges, but we have only a few d. For example, if d=1, t=10^7; d=2, t=5e6; etc. But we likely have no d=1? Let's check.
If there is a triple with sum 1, then a+b+c=1 impossible since positive integers. So d>=3.
Let's compute E using loops but careful about time.
We'll compute sum_s2_dk by iterating k and using s2.
import time start = time.time() E4 = 0 for d, cnt in G2.items(): t = M // d sum_k = t * (t + 1) // 2 # compute sum of s2(dk) for k=1..t sum_s2_dk = 0 # iterate k for k in range(1, t+1): sum_s2_dk += s2[dk] contrib = d * sum_k - sum_s2_dk E4 += cnt * contrib end = time.time() print("E4 computed in", end-start, "seconds:", E4)
Let's verify with a smaller M to see if formula matches direct sum.
For small M, compute directly: E_small = sum_{n=1}^{M} F(n) * (n - s_2(n)).
Compute F(n) = sum_{d|n} G(d). Let's test M=1000.
M_small = 1000
Compute F(n) for n=1..M_small
F_small = [0]*(M_small+1) for d in G2: for n in range(d, M_small+1, d): F_small[n] += G2[d]
Compute direct E
E_direct = 0 for n in range(1, M_small+1): E_direct += F_small[n] * (n - s2[n]) print("\nDirect E for M=1000:", E_direct)
Compute using formula with d
E_formula = 0 for d, cnt in G2.items(): t = M_small // d sum_k = t * (t + 1) // 2 sum_s2_dk = 0 for k in range(1, t+1): sum_s2_dk += s2[d*k] contrib = d * sum_k - sum_s2_dk E_formula += cnt * contrib print("E from formula M=1000:", E_formula) print("Match?", E_direct == E_formula)
Good.
Now we need to compute E for M=10^7. That's what we did.
But we must be careful: our precomputed s2 array size M+1 = 10^7+1, memory about 40 MB, okay.
However, the loop for d=1 (if exists) would take 10^7 iterations. But d=1 not in G2.
Let's check if any d in G2 has t large.
d=3? t=3333333. That's 3.3 million iterations. Acceptable.
Let's compute total iterations: sum_{d in G2} t = sum_{d} M//d.
Since d are small, total iterations maybe ~ M * sum_{d} 1/d. For d up to maybe 100, sum 1/d ~ log(100) ~ 4.6. So total iterations ~ 4.6e7. That's okay in Python? Might take a few seconds.
Let's compute total iterations estimate.
total_iters = 0 for d in G2: total_iters += M // d print("Total iterations for sum_s2_dk:", total_iters)
That's ~4.6e7, which is fine.
However, we already computed E4. Let's print final E.
print("\nFinal E =", E4)
But we need to ensure no off-by-one errors: sum_{k=1}^{t} k = t*(t+1)//2 correct.
sum_{k=1}^{t} s2(d*k) computed correctly.
Let's verify with a small d and known values.
For d=1, t=10, sum_k=55, sum_s2_dk = sum_{k=1}^{10} s2(k) = 1+1+2+1+2+2+3+1+2+2 = 17? Let's compute manually.
k:1->1,2->1,3->2,4->1,5->2,6->2,7->3,8->1,9->2,10->2 total=1+1+2+1+2+2+3+1+2+2=17.
Our function should give 17.
print("Test d=1,t=10 sum_s2:", sum_s2_dtimes_dk_fast(1,10))
Also compute contrib = 1*55 - 17 = 38.
Now compute directly: sum_{k=1}^{10} (k - s2(k)) = (1-1)+(2-1)+(3-2)+(4-1)+(5-2)+(6-2)+(7-3)+(8-1)+(9-2)+(10-2) = 0+1+1+3+3+4+4+7+7+8 = 38. Good.
So formula correct.
Now final answer E.
But we must output E as integer digits.
Let's compute E with high precision (it's integer).
print("\nE =", E4)
Ensure E4 is integer.
Let's compute again with maybe more careful loops to avoid any mistake.
We'll recompute with separate function for sum_s2_dk using precomputed s2.
def compute_E(): M = 10_000_000 s2 = [0](M+1) for i in range(1, M+1): s2[i] = s2[i>>1] + (i&1) E = 0 for d, cnt in G2.items(): t = M // d sum_k = t(t+1)//2 sum_s2_dk = 0 # iterate k for k in range(1, t+1): sum_s2_dk += s2[dk] contrib = dsum_k - sum_s2_dk E += cnt * contrib return E
But this recomputes s2 each time. We'll just use previous s2.
However, we need to ensure s2 is precomputed up to M. We already have s2.
Let's compute E again with same method but maybe using list comprehension for sum_s2_dk? Not necessary.
We'll compute for each d.
print("Computing E...") E_final = 0 for d, cnt in G2.items(): t = M // d sum_k = t * (t + 1) // 2 # compute sum_s2_dk # Use Python's sum with generator to avoid explicit loop? Might be slower. # We'll keep loop. sum_s2_dk = 0 # We can iterate over range and accumulate. # For large t, this is heavy. But we have few d. for k in range(1, t+1): sum_s2_dk += s2[d*k] contrib = d * sum_k - sum_s2_dk E_final += cnt * contrib print("E_final =", E_final)
Let's also compute using alternative: sum_{n=1}^{M} F(n)*(n - s2(n)) via convolution? Not needed.
We'll output E_final.
But we need to ensure no overflow; Python integers are arbitrary precision.
Let's output E_final as integer.
print("E_final =", E_final)
However, we should verify that all triples are indeed found. Let's list them.
print("\nAll triples (a,b,c):") for a,b,c in triples2: print(a,b,c)
Compute sums and G2 again to double-check.
sums_all = [a+b+c for a,b,c in triples2] G_all = Counter(sums_all) print("\nAll sums counts:", G_all)
Ensure G_all == G2.
if G2 == G_all: print("Counts match.") else: print("Mismatch.")
Now final answer.
Let's compute E using the formula with G_all.
E_check = 0 for d, cnt in G_all.items(): t = M // d sum_k = t*(t+1)//2 sum_s2_dk = 0 for k in range(1, t+1): sum_s2_dk += s2[dk] contrib = dsum_k - sum_s2_dk E_check += cnt * contrib
print("E_check =", E_check) print("E_final == E_check?", E_final == E_check)
All good.
Now we have E_final.
But wait: we used G2 from triples2. However, triples2 might include duplicates? Our search loops produce each triple once. So no duplicates.
Let's output final answer.
However, we need to ensure that there are no other triples beyond a=100000. We argued via equations that x,y,z small, so likely none.
Let's do a quick check: from equation a = (xy + x + 1)/(xyz - 1). For x,y,z >=1, denominator grows fast. For a to be integer, denominator must divide numerator. Since numerator ~ xy, denominator ~ xyz, so z must be small. Let's search for z up to 10, x,y up to 100 maybe.
But we already did x,y,z up to 100, which gave same triples. So likely complete.
Thus final E is the answer.
Let's print final answer in boxed format.
print("\n\boxed{" + str(E_final) + "}") [/PYTHON]
[THOUGHT] The Python output confirms that the only cyclically divisible triples are the 10 triples found, with sums 3, 4, 6, 12 and multiplicities as given. Using the precomputed binary digit sums and the formula for (E = v_2(\mathcal{K})), we computed (E = 91666486036450). The direct verification for (M=1000) matches, and the total computation for (M=10^7) is consistent. Therefore, the exact value of (E) is (91666486036450).
\boxed{91666486036450}