Finding the remainder of an exhausted $m!$
up vote
3
down vote
favorite
For any prime $p$, let $n_p(m)$ denote the exponent of $p$ in the factorisation of $m!$, i.e. $m!=p^{n_p(m)}cdot k$ with $pnotmid k$.
I wonder if there is a general formula for $frac{m!}{p^{n_p(m)}}$ modulo $p$?
I could not prove but I believe that the frequencies of $1,2,...,p-1$ are equal.
modular-arithmetic factorial
add a comment |
up vote
3
down vote
favorite
For any prime $p$, let $n_p(m)$ denote the exponent of $p$ in the factorisation of $m!$, i.e. $m!=p^{n_p(m)}cdot k$ with $pnotmid k$.
I wonder if there is a general formula for $frac{m!}{p^{n_p(m)}}$ modulo $p$?
I could not prove but I believe that the frequencies of $1,2,...,p-1$ are equal.
modular-arithmetic factorial
"frequencies" in what sense? across all higher factorials?
– Joffan
Jul 6 '16 at 21:50
I simply meant when I take $m=50$ and $p=3,5$ or $7$, the number of occurrences of $1,2,...,p-1$ as remainders are almost equal.
– Levent
Jul 6 '16 at 21:54
You can't talk about a frequency when you only look at one value of $m$.
– Joffan
Jul 6 '16 at 22:42
Sorry, what I mean is when I take $m=2$ up to $50$.
– Levent
Jul 6 '16 at 22:51
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
For any prime $p$, let $n_p(m)$ denote the exponent of $p$ in the factorisation of $m!$, i.e. $m!=p^{n_p(m)}cdot k$ with $pnotmid k$.
I wonder if there is a general formula for $frac{m!}{p^{n_p(m)}}$ modulo $p$?
I could not prove but I believe that the frequencies of $1,2,...,p-1$ are equal.
modular-arithmetic factorial
For any prime $p$, let $n_p(m)$ denote the exponent of $p$ in the factorisation of $m!$, i.e. $m!=p^{n_p(m)}cdot k$ with $pnotmid k$.
I wonder if there is a general formula for $frac{m!}{p^{n_p(m)}}$ modulo $p$?
I could not prove but I believe that the frequencies of $1,2,...,p-1$ are equal.
modular-arithmetic factorial
modular-arithmetic factorial
edited Nov 19 at 22:44
asked Jul 6 '16 at 21:10
Levent
3,386825
3,386825
"frequencies" in what sense? across all higher factorials?
– Joffan
Jul 6 '16 at 21:50
I simply meant when I take $m=50$ and $p=3,5$ or $7$, the number of occurrences of $1,2,...,p-1$ as remainders are almost equal.
– Levent
Jul 6 '16 at 21:54
You can't talk about a frequency when you only look at one value of $m$.
– Joffan
Jul 6 '16 at 22:42
Sorry, what I mean is when I take $m=2$ up to $50$.
– Levent
Jul 6 '16 at 22:51
add a comment |
"frequencies" in what sense? across all higher factorials?
– Joffan
Jul 6 '16 at 21:50
I simply meant when I take $m=50$ and $p=3,5$ or $7$, the number of occurrences of $1,2,...,p-1$ as remainders are almost equal.
– Levent
Jul 6 '16 at 21:54
You can't talk about a frequency when you only look at one value of $m$.
– Joffan
Jul 6 '16 at 22:42
Sorry, what I mean is when I take $m=2$ up to $50$.
– Levent
Jul 6 '16 at 22:51
"frequencies" in what sense? across all higher factorials?
– Joffan
Jul 6 '16 at 21:50
"frequencies" in what sense? across all higher factorials?
– Joffan
Jul 6 '16 at 21:50
I simply meant when I take $m=50$ and $p=3,5$ or $7$, the number of occurrences of $1,2,...,p-1$ as remainders are almost equal.
– Levent
Jul 6 '16 at 21:54
I simply meant when I take $m=50$ and $p=3,5$ or $7$, the number of occurrences of $1,2,...,p-1$ as remainders are almost equal.
– Levent
Jul 6 '16 at 21:54
You can't talk about a frequency when you only look at one value of $m$.
– Joffan
Jul 6 '16 at 22:42
You can't talk about a frequency when you only look at one value of $m$.
– Joffan
Jul 6 '16 at 22:42
Sorry, what I mean is when I take $m=2$ up to $50$.
– Levent
Jul 6 '16 at 22:51
Sorry, what I mean is when I take $m=2$ up to $50$.
– Levent
Jul 6 '16 at 22:51
add a comment |
3 Answers
3
active
oldest
votes
up vote
4
down vote
Does not seem to be that simple as we let things run high; I did primes 5, 7, 11. Seems reasonable to suggest 1, p-1 are the same and highest, after that not clear, although 5, 7 seem symmetric. I ran 11 pretty high, I guess if a+b = 11 then their counts are similar.
1 count 1330 2 count 1169 3 count 1169 4 count 1332
1 count 2570 2 count 2220 3 count 2230 4 count 2210 5 count 2220 6 count 2550
1 count 121894 2 count 115087 3 count 99710 4 count 100842 5 count 113429
6 count 112909 7 count 99693 8 count 99050 9 count 114123 10 count 123263
int main()
{
int p = 11;
int count[p] ;
int fac = 1;
for(int i = 1; i < p; ++i) count[i] = 0;
for(int i = 1; i <= 100000 * p; ++i)
{
int n = i;
while ( n % p == 0 ) n /= p;
n %= p;
fac *= n;
fac %= p;
count[fac] = 1 + count[fac];
cout << i << " " << fac << " count " << count[fac] << endl;
}
for(int i = 1; i < p; ++i) cout << i << " count " << count[i] << " " ;
cout << endl << endl;
return 0 ;
}
1
I had similar results on those primes, but on 13, 17, 19 a result of "1" stayed high but the remaining values started to flatten out (testing to 30000)
– Joffan
Jul 6 '16 at 22:38
add a comment |
up vote
1
down vote
With $k$ as in the question, define $F(m)$ to be the residue of $k$ modulo $p$.
A formula
Let $m=a+bp$, where $0le ale p-1$. Then, modulo $p$, $F(m)$ is congruent to $a!(p-1)!^bF(b)$. By Wilson's Theorem this simplifies to $a!(-1)^bF(b)$.
So, in general, let $$m=a_0+a_1p+a_2p^2+...+a_{2n-1}p^{2n-1},0le a_ile p-1.$$
Then, for $A=a_1+a_3+...+a_{2n-1}$, $F(m)$ is congruent, modulo $p$, to
$$a_0!a_1!...a_{2n-1}!(-1)^A.$$
Frequencies
The formula shows that $F(m)$ is the product modulo $p$ $$F(a_0+a_1p) F(a_2+a_3p)...F(a_{2n-2}+a_{2n-1}p).$$
Therefore the frequencies for the $p^2$numbers $0!,1!,...,(p^2-1)!$ determine the frequencies for the $p^4$numbers up to $(p^4-1)!$ etc. etc.
For example, modulo 3 there are 4 1s and 5 2s from 0! to 8!
So up to 80! there are $4^2+5^2=41$ 1s and $2.4.5=40$ 2s.
I don't see why $F(m)$ is congruent to $a!cdot (p-1)!^b F(b)$. Take, for example, $p=3, a=0,b=3$ so $m=9$. Then $k=1$ so $F(m)cong 1pmod 2$ but the formula you present gives $2$.
– Levent
Dec 9 '17 at 21:59
add a comment |
up vote
0
down vote
Same about
$F(m,p) = F(m mod p , p) dot F(m div p , p) dot (-1)^{m div p} $
with the integer division.
add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
4
down vote
Does not seem to be that simple as we let things run high; I did primes 5, 7, 11. Seems reasonable to suggest 1, p-1 are the same and highest, after that not clear, although 5, 7 seem symmetric. I ran 11 pretty high, I guess if a+b = 11 then their counts are similar.
1 count 1330 2 count 1169 3 count 1169 4 count 1332
1 count 2570 2 count 2220 3 count 2230 4 count 2210 5 count 2220 6 count 2550
1 count 121894 2 count 115087 3 count 99710 4 count 100842 5 count 113429
6 count 112909 7 count 99693 8 count 99050 9 count 114123 10 count 123263
int main()
{
int p = 11;
int count[p] ;
int fac = 1;
for(int i = 1; i < p; ++i) count[i] = 0;
for(int i = 1; i <= 100000 * p; ++i)
{
int n = i;
while ( n % p == 0 ) n /= p;
n %= p;
fac *= n;
fac %= p;
count[fac] = 1 + count[fac];
cout << i << " " << fac << " count " << count[fac] << endl;
}
for(int i = 1; i < p; ++i) cout << i << " count " << count[i] << " " ;
cout << endl << endl;
return 0 ;
}
1
I had similar results on those primes, but on 13, 17, 19 a result of "1" stayed high but the remaining values started to flatten out (testing to 30000)
– Joffan
Jul 6 '16 at 22:38
add a comment |
up vote
4
down vote
Does not seem to be that simple as we let things run high; I did primes 5, 7, 11. Seems reasonable to suggest 1, p-1 are the same and highest, after that not clear, although 5, 7 seem symmetric. I ran 11 pretty high, I guess if a+b = 11 then their counts are similar.
1 count 1330 2 count 1169 3 count 1169 4 count 1332
1 count 2570 2 count 2220 3 count 2230 4 count 2210 5 count 2220 6 count 2550
1 count 121894 2 count 115087 3 count 99710 4 count 100842 5 count 113429
6 count 112909 7 count 99693 8 count 99050 9 count 114123 10 count 123263
int main()
{
int p = 11;
int count[p] ;
int fac = 1;
for(int i = 1; i < p; ++i) count[i] = 0;
for(int i = 1; i <= 100000 * p; ++i)
{
int n = i;
while ( n % p == 0 ) n /= p;
n %= p;
fac *= n;
fac %= p;
count[fac] = 1 + count[fac];
cout << i << " " << fac << " count " << count[fac] << endl;
}
for(int i = 1; i < p; ++i) cout << i << " count " << count[i] << " " ;
cout << endl << endl;
return 0 ;
}
1
I had similar results on those primes, but on 13, 17, 19 a result of "1" stayed high but the remaining values started to flatten out (testing to 30000)
– Joffan
Jul 6 '16 at 22:38
add a comment |
up vote
4
down vote
up vote
4
down vote
Does not seem to be that simple as we let things run high; I did primes 5, 7, 11. Seems reasonable to suggest 1, p-1 are the same and highest, after that not clear, although 5, 7 seem symmetric. I ran 11 pretty high, I guess if a+b = 11 then their counts are similar.
1 count 1330 2 count 1169 3 count 1169 4 count 1332
1 count 2570 2 count 2220 3 count 2230 4 count 2210 5 count 2220 6 count 2550
1 count 121894 2 count 115087 3 count 99710 4 count 100842 5 count 113429
6 count 112909 7 count 99693 8 count 99050 9 count 114123 10 count 123263
int main()
{
int p = 11;
int count[p] ;
int fac = 1;
for(int i = 1; i < p; ++i) count[i] = 0;
for(int i = 1; i <= 100000 * p; ++i)
{
int n = i;
while ( n % p == 0 ) n /= p;
n %= p;
fac *= n;
fac %= p;
count[fac] = 1 + count[fac];
cout << i << " " << fac << " count " << count[fac] << endl;
}
for(int i = 1; i < p; ++i) cout << i << " count " << count[i] << " " ;
cout << endl << endl;
return 0 ;
}
Does not seem to be that simple as we let things run high; I did primes 5, 7, 11. Seems reasonable to suggest 1, p-1 are the same and highest, after that not clear, although 5, 7 seem symmetric. I ran 11 pretty high, I guess if a+b = 11 then their counts are similar.
1 count 1330 2 count 1169 3 count 1169 4 count 1332
1 count 2570 2 count 2220 3 count 2230 4 count 2210 5 count 2220 6 count 2550
1 count 121894 2 count 115087 3 count 99710 4 count 100842 5 count 113429
6 count 112909 7 count 99693 8 count 99050 9 count 114123 10 count 123263
int main()
{
int p = 11;
int count[p] ;
int fac = 1;
for(int i = 1; i < p; ++i) count[i] = 0;
for(int i = 1; i <= 100000 * p; ++i)
{
int n = i;
while ( n % p == 0 ) n /= p;
n %= p;
fac *= n;
fac %= p;
count[fac] = 1 + count[fac];
cout << i << " " << fac << " count " << count[fac] << endl;
}
for(int i = 1; i < p; ++i) cout << i << " count " << count[i] << " " ;
cout << endl << endl;
return 0 ;
}
answered Jul 6 '16 at 22:15
Will Jagy
101k598198
101k598198
1
I had similar results on those primes, but on 13, 17, 19 a result of "1" stayed high but the remaining values started to flatten out (testing to 30000)
– Joffan
Jul 6 '16 at 22:38
add a comment |
1
I had similar results on those primes, but on 13, 17, 19 a result of "1" stayed high but the remaining values started to flatten out (testing to 30000)
– Joffan
Jul 6 '16 at 22:38
1
1
I had similar results on those primes, but on 13, 17, 19 a result of "1" stayed high but the remaining values started to flatten out (testing to 30000)
– Joffan
Jul 6 '16 at 22:38
I had similar results on those primes, but on 13, 17, 19 a result of "1" stayed high but the remaining values started to flatten out (testing to 30000)
– Joffan
Jul 6 '16 at 22:38
add a comment |
up vote
1
down vote
With $k$ as in the question, define $F(m)$ to be the residue of $k$ modulo $p$.
A formula
Let $m=a+bp$, where $0le ale p-1$. Then, modulo $p$, $F(m)$ is congruent to $a!(p-1)!^bF(b)$. By Wilson's Theorem this simplifies to $a!(-1)^bF(b)$.
So, in general, let $$m=a_0+a_1p+a_2p^2+...+a_{2n-1}p^{2n-1},0le a_ile p-1.$$
Then, for $A=a_1+a_3+...+a_{2n-1}$, $F(m)$ is congruent, modulo $p$, to
$$a_0!a_1!...a_{2n-1}!(-1)^A.$$
Frequencies
The formula shows that $F(m)$ is the product modulo $p$ $$F(a_0+a_1p) F(a_2+a_3p)...F(a_{2n-2}+a_{2n-1}p).$$
Therefore the frequencies for the $p^2$numbers $0!,1!,...,(p^2-1)!$ determine the frequencies for the $p^4$numbers up to $(p^4-1)!$ etc. etc.
For example, modulo 3 there are 4 1s and 5 2s from 0! to 8!
So up to 80! there are $4^2+5^2=41$ 1s and $2.4.5=40$ 2s.
I don't see why $F(m)$ is congruent to $a!cdot (p-1)!^b F(b)$. Take, for example, $p=3, a=0,b=3$ so $m=9$. Then $k=1$ so $F(m)cong 1pmod 2$ but the formula you present gives $2$.
– Levent
Dec 9 '17 at 21:59
add a comment |
up vote
1
down vote
With $k$ as in the question, define $F(m)$ to be the residue of $k$ modulo $p$.
A formula
Let $m=a+bp$, where $0le ale p-1$. Then, modulo $p$, $F(m)$ is congruent to $a!(p-1)!^bF(b)$. By Wilson's Theorem this simplifies to $a!(-1)^bF(b)$.
So, in general, let $$m=a_0+a_1p+a_2p^2+...+a_{2n-1}p^{2n-1},0le a_ile p-1.$$
Then, for $A=a_1+a_3+...+a_{2n-1}$, $F(m)$ is congruent, modulo $p$, to
$$a_0!a_1!...a_{2n-1}!(-1)^A.$$
Frequencies
The formula shows that $F(m)$ is the product modulo $p$ $$F(a_0+a_1p) F(a_2+a_3p)...F(a_{2n-2}+a_{2n-1}p).$$
Therefore the frequencies for the $p^2$numbers $0!,1!,...,(p^2-1)!$ determine the frequencies for the $p^4$numbers up to $(p^4-1)!$ etc. etc.
For example, modulo 3 there are 4 1s and 5 2s from 0! to 8!
So up to 80! there are $4^2+5^2=41$ 1s and $2.4.5=40$ 2s.
I don't see why $F(m)$ is congruent to $a!cdot (p-1)!^b F(b)$. Take, for example, $p=3, a=0,b=3$ so $m=9$. Then $k=1$ so $F(m)cong 1pmod 2$ but the formula you present gives $2$.
– Levent
Dec 9 '17 at 21:59
add a comment |
up vote
1
down vote
up vote
1
down vote
With $k$ as in the question, define $F(m)$ to be the residue of $k$ modulo $p$.
A formula
Let $m=a+bp$, where $0le ale p-1$. Then, modulo $p$, $F(m)$ is congruent to $a!(p-1)!^bF(b)$. By Wilson's Theorem this simplifies to $a!(-1)^bF(b)$.
So, in general, let $$m=a_0+a_1p+a_2p^2+...+a_{2n-1}p^{2n-1},0le a_ile p-1.$$
Then, for $A=a_1+a_3+...+a_{2n-1}$, $F(m)$ is congruent, modulo $p$, to
$$a_0!a_1!...a_{2n-1}!(-1)^A.$$
Frequencies
The formula shows that $F(m)$ is the product modulo $p$ $$F(a_0+a_1p) F(a_2+a_3p)...F(a_{2n-2}+a_{2n-1}p).$$
Therefore the frequencies for the $p^2$numbers $0!,1!,...,(p^2-1)!$ determine the frequencies for the $p^4$numbers up to $(p^4-1)!$ etc. etc.
For example, modulo 3 there are 4 1s and 5 2s from 0! to 8!
So up to 80! there are $4^2+5^2=41$ 1s and $2.4.5=40$ 2s.
With $k$ as in the question, define $F(m)$ to be the residue of $k$ modulo $p$.
A formula
Let $m=a+bp$, where $0le ale p-1$. Then, modulo $p$, $F(m)$ is congruent to $a!(p-1)!^bF(b)$. By Wilson's Theorem this simplifies to $a!(-1)^bF(b)$.
So, in general, let $$m=a_0+a_1p+a_2p^2+...+a_{2n-1}p^{2n-1},0le a_ile p-1.$$
Then, for $A=a_1+a_3+...+a_{2n-1}$, $F(m)$ is congruent, modulo $p$, to
$$a_0!a_1!...a_{2n-1}!(-1)^A.$$
Frequencies
The formula shows that $F(m)$ is the product modulo $p$ $$F(a_0+a_1p) F(a_2+a_3p)...F(a_{2n-2}+a_{2n-1}p).$$
Therefore the frequencies for the $p^2$numbers $0!,1!,...,(p^2-1)!$ determine the frequencies for the $p^4$numbers up to $(p^4-1)!$ etc. etc.
For example, modulo 3 there are 4 1s and 5 2s from 0! to 8!
So up to 80! there are $4^2+5^2=41$ 1s and $2.4.5=40$ 2s.
answered Dec 7 '17 at 15:12
S. Dolan
1,205112
1,205112
I don't see why $F(m)$ is congruent to $a!cdot (p-1)!^b F(b)$. Take, for example, $p=3, a=0,b=3$ so $m=9$. Then $k=1$ so $F(m)cong 1pmod 2$ but the formula you present gives $2$.
– Levent
Dec 9 '17 at 21:59
add a comment |
I don't see why $F(m)$ is congruent to $a!cdot (p-1)!^b F(b)$. Take, for example, $p=3, a=0,b=3$ so $m=9$. Then $k=1$ so $F(m)cong 1pmod 2$ but the formula you present gives $2$.
– Levent
Dec 9 '17 at 21:59
I don't see why $F(m)$ is congruent to $a!cdot (p-1)!^b F(b)$. Take, for example, $p=3, a=0,b=3$ so $m=9$. Then $k=1$ so $F(m)cong 1pmod 2$ but the formula you present gives $2$.
– Levent
Dec 9 '17 at 21:59
I don't see why $F(m)$ is congruent to $a!cdot (p-1)!^b F(b)$. Take, for example, $p=3, a=0,b=3$ so $m=9$. Then $k=1$ so $F(m)cong 1pmod 2$ but the formula you present gives $2$.
– Levent
Dec 9 '17 at 21:59
add a comment |
up vote
0
down vote
Same about
$F(m,p) = F(m mod p , p) dot F(m div p , p) dot (-1)^{m div p} $
with the integer division.
add a comment |
up vote
0
down vote
Same about
$F(m,p) = F(m mod p , p) dot F(m div p , p) dot (-1)^{m div p} $
with the integer division.
add a comment |
up vote
0
down vote
up vote
0
down vote
Same about
$F(m,p) = F(m mod p , p) dot F(m div p , p) dot (-1)^{m div p} $
with the integer division.
Same about
$F(m,p) = F(m mod p , p) dot F(m div p , p) dot (-1)^{m div p} $
with the integer division.
answered Dec 10 '17 at 0:41
kotomord
1,455626
1,455626
add a comment |
add a comment |
Thanks for contributing an answer to Mathematics Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
Use MathJax to format equations. MathJax reference.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1851411%2ffinding-the-remainder-of-an-exhausted-m%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
"frequencies" in what sense? across all higher factorials?
– Joffan
Jul 6 '16 at 21:50
I simply meant when I take $m=50$ and $p=3,5$ or $7$, the number of occurrences of $1,2,...,p-1$ as remainders are almost equal.
– Levent
Jul 6 '16 at 21:54
You can't talk about a frequency when you only look at one value of $m$.
– Joffan
Jul 6 '16 at 22:42
Sorry, what I mean is when I take $m=2$ up to $50$.
– Levent
Jul 6 '16 at 22:51