let n, b be Nat; :: thesis: ( b > 1 implies ( b divides n iff (digits n,b) . 0 = 0 ) )
reconsider B = b as Element of NAT by ORDINAL1:def 13;
assume A1:
b > 1
; :: thesis: ( b divides n iff (digits n,b) . 0 = 0 )
thus
( b divides n implies (digits n,b) . 0 = 0 )
:: thesis: ( (digits n,b) . 0 = 0 implies b divides n )proof
assume A2:
b divides n
;
:: thesis: (digits n,b) . 0 = 0
consider d being
XFinSequence of
such that A3:
(
dom d = dom (digits n,b) & ( for
i being
Nat st
i in dom d holds
d . i = ((digits n,b) . i) * (b |^ i) ) &
value (digits n,b),
b = Sum d )
by Def1;
A4:
len (digits n,b) >= 1
by A1, Th7;
per cases
( len (digits n,b) = 1 or len (digits n,b) > 1 )
by A4, XXREAL_0:1;
suppose A9:
len (digits n,b) > 1
;
:: thesis: (digits n,b) . 0 = 0 then reconsider k =
(len (digits n,b)) - 1 as
Element of
NAT by NAT_1:21;
A10:
0 in dom (digits n,b)
by A9, NAT_1:45;
defpred S1[
Element of
NAT ,
set ]
means $2
= d . ($1 + 1);
A11:
for
u being
Element of
NAT st
u in k holds
ex
x being
Element of
NAT st
S1[
u,
x]
;
consider d' being
XFinSequence of
such that A12:
(
dom d' = k & ( for
x being
Element of
NAT st
x in k holds
S1[
x,
d' . x] ) )
from STIRL2_1:sch 6(A11);
then
b divides Sum d'
by Th5;
then A15:
(Sum d') mod B = 0
by A1, PEPIN:6;
A16:
dom d =
k + 1
by A3
.=
(len <%(d . 0 )%>) + (len d')
by A12, AFINSQ_1:36
;
then
d = <%(d . 0 )%> ^ d'
by A16, A17, AFINSQ_1:def 4;
then
Sum d = (Sum <%(d . 0 )%>) + (Sum d')
by Th1;
then
n = (Sum <%(d . 0 )%>) + (Sum d')
by A1, A3, Th8;
then
n = (d . 0 ) + (Sum d')
by STIRL2_1:44;
then
((d . 0 ) + (Sum d')) mod B = 0
by A1, A2, PEPIN:6;
then
(d . 0 ) mod b = 0
by A15, NAT_D:17;
then
B divides d . 0
by A1, PEPIN:6;
then
b divides ((digits n,b) . 0 ) * (b |^ 0 )
by A3, A10;
then A19:
b divides ((digits n,b) . 0 ) * 1
by NEWTON:9;
end; end;
end;
assume A20:
(digits n,b) . 0 = 0
; :: thesis: b divides n
consider d being XFinSequence of such that
A21:
( dom d = dom (digits n,b) & ( for i being Nat st i in dom d holds
d . i = ((digits n,b) . i) * (b |^ i) ) & value (digits n,b),b = Sum d )
by Def1;
then
b divides value (digits n,b),b
by A21, Th5;
hence
b divides n
by A1, Th8; :: thesis: verum