:: Elementary Number Theory Problems. {P}art {XVIII}
:: by Adam Grabowski
::
:: Received December 21, 2025
:: Copyright (c) 2025-2026 Association of Mizar Users
:: (Stowarzyszenie Uzytkownikow Mizara, Bialystok, Poland).
:: This code can be distributed under the GNU General Public Licence
:: version 3.0 or later, or the Creative Commons Attribution-ShareAlike
:: License version 4.0 or later, subject to the binding interpretation
:: detailed in file COPYING.interpretation.
:: See COPYING.GPL and COPYING.CC-BY-SA for the full text of these
:: licenses, or see http://www.gnu.org/licenses/gpl.html and
:: http://creativecommons.org/licenses/by-sa/4.0/.
environ
vocabularies NUMBERS, NAT_1, RELAT_1, FUNCT_1, XXREAL_0, ARYTM_3, XCMPLX_0,
CARD_1, INT_1, NEWTON, INT_2, ARYTM_1, SUBSET_1, XBOOLE_0, TARSKI,
FINSET_1, PBOOLE, ABIAN, SQUARE_1, MEMBERED, ZFMISC_1, ORDINAL1, POWER,
REAL_1, PARTFUN3, VALUED_0, REALSET1, NUMPOLY1, EUCLID_3, FUNCT_7,
ORDINAL2, MOEBIUS1, FINSEQ_1, CARD_3, NUMBER06, PRE_POLY, NAT_3,
PARTFUN1, PEPIN, ORDINAL4, FUNCOP_1, NUMBER18, GR_CY_3, NUMBER12, NAT_5,
PROB_1, RFUNCT_3, FINSEQ_2, MSSUBFAM, NEWTON04, UPROOTS, ROBBINS1;
notations TARSKI, XBOOLE_0, ZFMISC_1, SUBSET_1, ENUMSET1, ORDINAL1, CARD_1,
XTUPLE_0, NUMBERS, XCMPLX_0, RELAT_1, FUNCT_1, PBOOLE, FINSET_1,
MEMBERED, FUNCOP_1, XREAL_0, INT_1, INT_2, NAT_1, NAT_D, XXREAL_0,
RFINSEQ, CARD_3, FUNCT_2, PARTFUN1, FINSEQ_1, SQUARE_1, FINSEQ_2,
FINSEQ_4, RVSUM_1, SGRAPH1, VALUED_0, PARTFUN3, VALUED_1, POWER, NEWTON,
ABIAN, SERIES_1, AFINSQ_1, PRE_POLY, NAT_3, PEPIN, INT_5, WSIERP_1,
GR_CY_3, UPROOTS, RFUNCT_3, NEWTON04, EULER_2, PYTHTRIP, NAT_5, MOEBIUS1,
NUMPOLY1, NUMBER06, NUMBER12;
constructors NAT_D, RELSET_1, NEWTON, ABIAN, NAT_6, ENUMSET1, EULER_1, PEPIN,
PYTHTRIP, PREPOWER, QUIN_1, SERIES_1, PARTFUN3, NUMPOLY1, MOEBIUS1,
FUNCOP_1, FINSOP_1, NAT_5, GR_CY_3, SGRAPH1, PRE_POLY, SQUARE_1, NAT_3,
LATSTONE, FINSEQ_4, INT_5, RVSUM_1, EULER_2, NUMBER04, RFINSEQ, FINSEQ_1,
SEQ_1, AFINSQ_1, PRE_FF, FIB_NUM2, NEWTON03, DOMAIN_1, CARD_3, NUMBER02,
NUMBER06, INT_7, WSIERP_1, RECDEF_1, NUMBER12, UPROOTS, CLASSES1,
RFUNCT_3, RVSUM_2, NEWTON04;
registrations ORDINAL1, RELSET_1, FINSET_1, NUMBERS, XCMPLX_0, XXREAL_0,
XREAL_0, NAT_1, INT_1, MEMBERED, VALUED_0, CARD_1, SQUARE_1, NEWTON,
NEWTON02, NEWTON03, FOMODEL0, ABIAN, NAT_6, JORDAN1D, POWER, SERIES_1,
LIOUVIL1, WSIERP_1, QUIN_1, AFINSQ_2, FUNCT_2, RELAT_1, XBOOLE_0,
FUNCT_1, NUMPOLY1, RVSUM_1, SEQ_1, NUMBER02, NUMBER06, NAT_3, LATSTONE,
NEWTON04, FINSEQ_1, NUMBER15, MOEBIUS1, NAT_5, PRE_POLY, MOEBIUS2,
NEWTON01, INT_6, NIVEN, VALUED_1, NUMBER10, HILB10_4, FUNCOP_1;
requirements REAL, NUMERALS, BOOLE, SUBSET, ARITHM;
begin
begin :: Problem 53
:: Prove that for every positive integer k the set of all positive integers
:: n whose number of positive integer divisors is divisible by k contains an
:: infinite arithmetic progression.
:: NatDivisors Revisited
definition let n
be Nat;
func Bnumber_of_divisors n -> ManySortedSet
of SetPrimes means
:: NUMBER18:def 1
support it = support pfexp n &
for p
being Nat st p
in support pfexp n
holds
it.p = (p |-count n) +
1;
end;
registration
let n
be non zero Nat;
cluster Bnumber_of_divisors n -> natural-valued finite-support;
end;
definition let n
be non zero Nat;
func number_of_divisors n -> Nat equals
:: NUMBER18:def 2
Product Bnumber_of_divisors n;
end;
theorem :: NUMBER18:1
for p
being Prime
holds (Bnumber_of_divisors p) * <*p*> = <*
2*>;
theorem :: NUMBER18:2
Bnumber_of_divisors
1 = EmptyBag SetPrimes;
theorem :: NUMBER18:3
for p
being Prime, n
being non zero Nat
holds
p |-count n =
0 implies (Bnumber_of_divisors n).p =
0;
theorem :: NUMBER18:4
for n
being non zero Nat, p
being Prime st
p |-count n <>
0 holds
(Bnumber_of_divisors n).p = (p |-count n) +
1;
theorem :: NUMBER18:5
for m, n
being non zero Nat st m, n are_coprime
holds
Bnumber_of_divisors (m * n) =
Bnumber_of_divisors m + Bnumber_of_divisors n;
::: sigma (k,n) from NAT_5:def 2 is sigma_k (n)
::: sigma (1,n) is the sum of divisors
::: sigma (0,n) is the number of divisors
definition let n
be Nat;
func #divs n -> Nat equals
:: NUMBER18:def 3
sigma (
0,n);
end;
theorem :: NUMBER18:6
EXP
0 = NAT -->
1;
theorem :: NUMBER18:7
EXP
1 = id NAT;
theorem :: NUMBER18:8
for n
being Nat st n =
0 holds
#divs n =
0;
theorem :: NUMBER18:9
for X
being finite Subset
of NAT
holds
Sum ((NAT -->
1) | X) = card X;
theorem :: NUMBER18:10
for p
being Prime
holds
#divs p =
2;
theorem :: NUMBER18:11
for m,n
being non zero Nat st
m,n are_coprime
holds
number_of_divisors (m * n) =
(number_of_divisors m) * (number_of_divisors n);
theorem :: NUMBER18:12
for n
being non zero Nat
holds
#divs n = card NatDivisors n;
theorem :: NUMBER18:13 :: trivial as k \/ {k} = succ k
for k
being Nat
holds
card (k \/ {k}) = k +
1;
theorem :: NUMBER18:14
for p
being Prime,
k
being Nat
holds
card NatDivisors (p |^ k) = k +
1;
definition
func Divs -> sequence
of NAT means
:: NUMBER18:def 4
for n
being Element
of NAT
holds it.n =
#divs n;
end;
theorem :: NUMBER18:15
for m,n
being non zero Nat st m,n are_coprime
holds
#divs (m*n) = (
#divs m ) *
#divs n;
theorem :: NUMBER18:16 ::: see DivsMulti
for m,n
being non zero Nat st m,n are_coprime
holds
card NatDivisors (m * n) =
(card NatDivisors m) * (card NatDivisors n);
:::theorem ::: reg by JORDAN1D:1, move wherever
::: for k being non zero Nat holds 2 |^ k is even;
theorem :: NUMBER18:17
for k
being Nat
holds
#divs (
2 |^ k) = k +
1;
::: ChatGPT says that
::: n = p ^ {k - 1} * m, m = 1, 2, 3... will do the work , which is false as if m = 2, then we obtain
::: n = 2 ^ (k - 1) * 2 = 2 ^ k, which has k+1 divisors
::: n = 2 ^ {k - 1} * m, m = 1, 2, 3... will do the work
:: 53. Prove that for every positive integer k the set of all positive integers
:: n whose number of positive integer divisors is divisible by k contains an
:: infinite arithmetic progression.
theorem :: NUMBER18:18 :::: Problem 53
for n
being non zero Nat, k, t
being Nat st
k >=
1 & n = (
2 |^ k) * t +
2 |^ (k -'
1)
holds
k divides card NatDivisors n;
definition let k
be Nat;
func Sierp53Seq k -> sequence
of REAL equals
:: NUMBER18:def 5
ArProg (
2 |^ (k -'
1),
2 |^ k);
end;
::: Maybe we get the set X of all n's such that
::: k divides card NatDivisors n
::: and then intersect X with rng Sierp53Seq, which is a subset of X
registration let k
be positive Nat, t
be Nat;
cluster (Sierp53Seq k).t -> non zero natural;
end;
theorem :: NUMBER18:19
for k
being positive Nat,
t
being Nat
holds
k divides card NatDivisors ((Sierp53Seq k).t);
begin :: Problem 61
theorem :: NUMBER18:20
for s
being Nat
ex f
being fAP-like increasing positive-yielding FinSequence
of NAT
st len f = s &
for i
being Nat st
1 <= i <= len f
holds f.i
is non prime;
begin :: Problem 81
:: Find three triangular numbers with prime indices, which form
:: an increasing arithmetic progression
theorem :: NUMBER18:21
ex p, q, r
being Prime st
Triangle p, Triangle q, Triangle r form_an_AP;
theorem :: NUMBER18:22
for p, q, r
being Prime st p =
127 & q =
3697 & r =
5227 holds
:: q * (q + 1) - p * (p + 1) = r * (r + 1) - q * (q + 1)
p * (p+
1), q * (q+
1), r * (r+
1) form_an_AP;
begin :: Problem 90
theorem :: NUMBER18:23
for m
being Nat st m >=
1 holds
Mersenne m
is Prime
implies
card PrimeDivisors Mersenne m =
1 &
card PrimeDivisors (Mersenne m +
1) =
1;
theorem :: NUMBER18:24
for m
being Nat st m >=
1 holds
Fermat m
is Prime
implies
card PrimeDivisors Fermat m =
1 &
card PrimeDivisors (Fermat m -
1) =
1;
begin :: Problem 90
:: 90. Prove that the theorem asserting that there exist only finitely many
:: positive integers n such that both n and n + 1 have only one prime divisor
:: is equivalent to the theorem asserting that there exist only finitely many
:: prime Mersenne numbers and finitely many prime Fermat numbers.
definition
func Mersenne_Primes -> Subset
of NAT equals
:: NUMBER18:def 6
{ n
where n
is Prime : n
is mersenne };
end;
definition let n
be Nat;
attr n
is fermat means
:: NUMBER18:def 7
ex k
being Nat st n = Fermat k;
end;
definition
func Fermat_Primes -> Subset
of NAT equals
:: NUMBER18:def 8
{ n
where n
is Prime : n
is fermat };
end;
theorem :: NUMBER18:25
for n
being mersenne Prime
holds
card PrimeDivisors n =
1 &
card PrimeDivisors (n+
1) =
1;
registration
cluster fermat
for Prime;
end;
theorem :: NUMBER18:26
for n
being fermat Prime
holds
card PrimeDivisors n =
1 &
card PrimeDivisors (n-
1) =
1;
theorem :: NUMBER18:27
Mersenne_Primes c= SetPrimes;
theorem :: NUMBER18:28
Fermat_Primes c= SetPrimes;
registration
cluster mersenne -> natural
for set;
end;
::: Sierpinski Theorem 2 about Mersenne numbers, p. 335
theorem :: NUMBER18:29
for m
be odd Nat, k
be Nat
st m divides
2 |^ k
holds
m =
1;
registration
cluster INT-valued
for FinSequence
of REAL;
end;
theorem :: NUMBER18:30
for F
being INT-valued FinSequence
of REAL st
len F
is odd &
for i
being Nat st i
in dom F
holds
F.i
is odd
holds
Sum F
is odd;
theorem :: NUMBER18:31
for n, k, m
being Nat st
n >
1 & m >
1 holds Mersenne n <> k |^ m;
theorem :: NUMBER18:32
card PrimeDivisors
1 =
0;
theorem :: NUMBER18:33
for k,l
being Nat st
2 |^ k -
2 |^ l =
2 & k >=
2 & l >=
1 holds
k =
2 & l =
1;
theorem :: NUMBER18:34
3 is fermat Prime;
theorem :: NUMBER18:35
3 is mersenne Prime;
registration
cluster odd natural
for Integer;
end;
theorem :: NUMBER18:36
PrimeDivisors
0 = SetPrimes;
registration
cluster card SetPrimes -> non zero;
end;
theorem :: NUMBER18:37
for n
being odd natural Integer, k
being Nat st
n divides
2 |^ k
holds n =
1;
theorem :: NUMBER18:38
for a, b
being Nat st a divides b
holds
PrimeDivisors a c= PrimeDivisors b;
theorem :: NUMBER18:39
for m,n
being Nat st PrimeDivisors n = {m}
holds
m |-count n >=
1 & n = m |^ (m |-count n);
theorem :: NUMBER18:40
for n
being even Nat st
card PrimeDivisors n =
1 holds
ex k
being Nat st k >=
1 & n =
2 |^ k;
theorem :: NUMBER18:41
for n
being odd Nat st
card PrimeDivisors n =
1 holds
ex k
being Nat,
p
be Prime st n = p |^ k;
theorem :: NUMBER18:42
for n
being even Nat st
card PrimeDivisors n =
1 holds
ex k
being Nat st n =
2 |^ k;
theorem :: NUMBER18:43 :: see JORDAN1D and PEPIN
for a, n
being Nat st n >
1 holds
a |^ n +
1 is odd iff a
is even;
theorem :: NUMBER18:44
for a, n
being Nat st
a >
1 & n >
1 & a |^ n +
1 is Prime
holds
n
is even;
theorem :: NUMBER18:45
for a, n
being Nat st
a >
1 & n >
1 & a |^ n +
1 is Prime
holds
a
is even &
ex k
being non zero Nat st
n =
2 |^ k;
registration let n
be Nat;
cluster Mersenne n -> mersenne;
end;
registration let n
be Nat;
cluster Fermat n -> fermat;
end;
theorem :: NUMBER18:46
card PrimeDivisors
0 =
1 & card PrimeDivisors (
0 +
1) =
1
implies
0 is mersenne Prime
or 0 +
1 is fermat Prime;
theorem :: NUMBER18:47
card PrimeDivisors
1 =
1 & card PrimeDivisors (
1 +
1) =
1
implies
1 is mersenne Prime
or 1 +
1 is fermat Prime;
theorem :: NUMBER18:48
card PrimeDivisors
2 =
1 & card PrimeDivisors (
2 +
1) =
1
implies
2 is mersenne Prime
or 2 +
1 is fermat Prime;
theorem :: NUMBER18:49
card PrimeDivisors
3 =
1 & card PrimeDivisors (
3 +
1) =
1
implies
3 is mersenne Prime
or 3 +
1 is fermat Prime;
theorem :: NUMBER18:50
card PrimeDivisors
4 =
1 & card PrimeDivisors (
4 +
1) =
1
implies
4 is mersenne Prime
or 4 +
1 is fermat Prime;
theorem :: NUMBER18:51
card PrimeDivisors
5 =
1 & card PrimeDivisors (
5 +
1) =
1
implies
5 is mersenne Prime
or 5 +
1 is fermat Prime;
theorem :: NUMBER18:52
card PrimeDivisors
6 =
1 & card PrimeDivisors (
6 +
1) =
1
implies
6 is mersenne Prime
or 6 +
1 is fermat Prime;
theorem :: NUMBER18:53
card PrimeDivisors
7 =
1 & card PrimeDivisors (
7 +
1) =
1
implies
7 is mersenne Prime
or 7 +
1 is fermat Prime;
::: by GR_CY_3:20
::: by PEPIN:52
theorem :: NUMBER18:54 :::
not (card PrimeDivisors
8 =
1 & card PrimeDivisors (
8 +
1) =
1
implies
8 is mersenne Prime
or 8 +
1 is fermat Prime);
theorem :: NUMBER18:55
for n
being Nat st n <
8 &
card PrimeDivisors n =
1 & card PrimeDivisors (n +
1) =
1
holds
n
is mersenne Prime
or n +
1 is fermat Prime;
theorem :: NUMBER18:56
for n
being Nat st n >
8 &
card PrimeDivisors n =
1 & card PrimeDivisors (n +
1) =
1
holds
n
is mersenne Prime
or n +
1 is fermat Prime;
theorem :: NUMBER18:57
for p
being Prime, k
being Nat st k >=
1 holds
card PrimeDivisors (p |^ k) =
1;
registration
cluster Mersenne_Primes -> non empty natural-membered;
end;
theorem :: NUMBER18:58 ::: Problem 90
{ n
where n
is Nat :
n >
8 & card PrimeDivisors n =
1 & card PrimeDivisors (n+
1) =
1 }
is infinite
implies
Mersenne_Primes \/ Fermat_Primes
is infinite;
theorem :: NUMBER18:59
Mersenne_Primes \/ Fermat_Primes
is finite
implies
{ n
where n
is Nat :
n >
8 & card PrimeDivisors n =
1 & card PrimeDivisors (n+
1) =
1 }
is finite;
theorem :: NUMBER18:60
for X
being infinite Subset
of NAT
holds
for a
being Nat
ex b
being Nat st b > a & b
in X;
theorem :: NUMBER18:61 :: Problem 90
{ n
where n
is Nat :
card PrimeDivisors n =
1 & card PrimeDivisors (n+
1) =
1 }
is finite
implies
Mersenne_Primes \/ Fermat_Primes
is finite;
begin :: Problem 100
:: Subsequent composite numbers in Mersenne sequence
:: 100.
:: Prove that the infinite sequence 2^n-1 (n = 1, 2, ... )
:: contains arbitrarily long subsequences of consecutive terms
:: consisting of composite numbers.
:: maybe there exists a segment between two numbers that f | Seg (a,a+n) is
:: composite-membered / subsequence?
definition
func Mersenne_sequence -> sequence
of NAT means
:: NUMBER18:def 9
for n
being Element
of NAT
holds
it.n = Mersenne n;
end;
theorem :: NUMBER18:62
for m,k
being Nat st m >= k >=
2 holds
2 |^ (m! + k) -
1 is not Prime;
theorem :: NUMBER18:63
for m
being Nat
holds
rng (Mersenne_sequence | Seg (m! +
2, m! + m)) misses SetPrimes;
begin :: Problem 156
theorem :: NUMBER18:64 ::: Problem 156, m = 1
not ex x,y,z
being positive Nat st
x |^
3 + y |^
3 + z |^
3 = x * y * z;
theorem :: NUMBER18:65 ::: Problem 156, m = 2
not ex x,y,z
being positive Nat st
x |^
3 + y |^
3 + z |^
3 =
2 * x * y * z;
theorem :: NUMBER18:66 ::: Problem 156, m = 3
for x,y,z
being positive Nat st
x |^
3 + y |^
3 + z |^
3 =
3 * x * y * z
holds
x = y & y = z;
begin :: Needed for Problem 167
theorem :: NUMBER18:67 :: Sierpinski Th. 16, p. 28
for a,b
being non zero Nat st a, b are_coprime
holds
ex u,v
being Nat st a * u - b * v =
1;
theorem :: NUMBER18:68
for a,b
being Real st a - b >
1 holds
ex t
being Integer st a > t > b;
theorem :: NUMBER18:69 :: Sierpinski, Corollary 2, p. 29
for a, b
being non zero Nat st a, b are_coprime
holds
for n
being Nat st n > a * b
holds
ex x,y
being non zero Nat st n = a * x + b * y;
:: Sierpinski, Corollary 3, p. 29
:: for a being non zero Nat,
:: m, n being non zero Nat holds
:: (a |^ m - 1) gcd (a |^ n - 1) = a |^ (m gcd n) - 1
:: by NUMBER03:26;
theorem :: NUMBER18:70
for m
being non zero Nat
holds
2 |^ m -
1, (
2 |^ m -
1) |^ m -
1 are_coprime;
::: for all sufficiently large
theorem :: NUMBER18:71
for m, n
being non zero Nat st
n > (
2 |^ m -
1) * ((
2 |^ m -
1) |^ m -
1)
holds
:::: improve the limit?
ex k,l
being non zero Nat st
n =
:::2 |^ m +
(
2 |^ m -
1) * k + ((
2 |^ m -
1) |^ m -
1) * l;
begin :: Problem 167
registration
let s
be Nat;
cluster s-element positive-yielding natural-valued
for FinSequence;
end;
registration
let s
be Nat;
let f
be s-element natural-valued FinSequence;
cluster f | s -> s-element;
end;
registration
let s
be Nat;
let f
be s-element positive-yielding natural-valued FinSequence;
cluster (f | s)" -> s-element;
end;
definition
let s,m
be Nat;
let f
be s-element positive-yielding natural-valued FinSequence;
attr f
is m-solution_of_Sierp167 means
:: NUMBER18:def 10
Sum (f" |^ m) =
1;
end;
theorem :: NUMBER18:72
for s, m
being Nat
for f
being s-element positive-yielding natural-valued FinSequence st
s =
2 |^ m & f = s |->
2 holds
f
is m-solution_of_Sierp167;
definition let s,m,a
be non zero Nat;
let f
be s-element positive-yielding natural-valued FinSequence;
func Expand (f,m,a) -> (s + a |^ m -
1)-element natural-valued FinSequence
equals
:: NUMBER18:def 11
(f | (s-'
1)) ^ ((a |^ m) |-> (a * f.s));
end;
registration let n
be non zero Nat;
let a
be positive Real;
cluster n |-> a -> positive-yielding;
end;
registration let s, a
be non zero Nat;
cluster s |-> a -> positive-yielding;
end;
registration let s,m,a
be non zero Nat;
let f
be s-element positive-yielding natural-valued FinSequence;
cluster Expand (f,m,a) -> positive-yielding;
end;
theorem :: NUMBER18:73
for f,g
being real-valued FinSequence,
m
being non zero Nat
holds
(f ^ g) |^ m = f |^ m ^ g |^ m;
theorem :: NUMBER18:74
for a
being Real,
m
being non zero Nat
holds
<* a *> |^ m = <* a |^ m *>;
theorem :: NUMBER18:75
for s, m, a
being non zero Nat,
f
being positive-yielding s-element natural-valued FinSequence,
g
being positive-yielding (s + a |^ m -
1)-element
natural-valued FinSequence
st g = Expand (f,m,a)
holds
Sum (f" |^ m) = Sum (g" |^ m);
theorem :: NUMBER18:76
for s, m, a
being non zero Nat,
f
being positive-yielding s-element natural-valued FinSequence st
f
is m-solution_of_Sierp167
holds
Expand (f,m,a)
is m-solution_of_Sierp167;
theorem :: NUMBER18:77
for m, s, k, l, a, b
being non zero Nat st
(
ex f
being positive-yielding s-element natural-valued FinSequence st
f
is m-solution_of_Sierp167)
holds
(
ex f
being positive-yielding
(s + (a |^ m -
1) * k + (b |^ m -
1) * l)-element
natural-valued FinSequence st
f
is m-solution_of_Sierp167);
theorem :: NUMBER18:78
for m
being non zero Nat
ex N
being Nat st
for n
being non zero Nat st n > N
holds
ex f
being positive-yielding n-element natural-valued FinSequence st
f
is m-solution_of_Sierp167;