# Sum of the digits in base $p+1$

Definition

Let $$W$$ be the function , defined as $$W(a,b)=r$$

given $$a,b\in \mathbb{Z_+}$$ and $$a>1$$

Take $$m$$ to be the integer s.t. $$a^{m+1} \ge b > a^{m}$$, i.e. $$m = \lceil \log{b}/\log{a} \rceil - 1$$.

Convert number $$a^{m+1} - b$$ in base $$a$$ and add its digits

$$a^{m+1} - b = (r_{l} r_{l-1} ... r_{1} r_{0})_{a}$$

Where $$r=\sum_{i=0}^{l}r_{i}$$

Example

$$W(5,77)=8$$

Identity$$1$$

if $$W(a,b)=r$$ then $$b+r\equiv 1($$ mod $$a-1)$$

$$S$$ is a function defined as

$$S(a,n)=\sum_{i=1}^{a}i^{n}$$

Where $$a$$ and $$n$$ are positive integer.

Let $$p$$ is prime and $$p+1=z$$

Question

show that

If $$z>2n+2$$ Then $$W(z,W(z,S(z,2n)))=z$$

Example

Let $$n=1$$ here, choose any $$z>4$$

Let $$z=6$$

So $$W(6,W(6,S(6,2)))=W(6,W(6,91))=W(6,10)=6$$

Table For $$W(t,W(t,S(t,2)))$$.

$$\begin{array}{c | c | c |c | } t & W(t,S(t,2)) & W(t,W(t,S(t,2))) \\ \hline 2 & 2 & 0 \\ \hline 3^{*} & 3 & 0 \\ \hline 4^{*} & 4 & 0 \\ \hline 5 & 6 & 7 \\ \hline 6^{*} & 10 & 6 \\ \hline 7 &5 & 2 \\ \hline 8^{*} &14& 8 \\ \hline 9 &12& 13 \\ \hline 10 &12& 16 \\ \hline 11 & 15 & 16 \\ \hline 12^{*} & 22 & 12 \\ \hline 13 & 10 & 3 \\ \hline 14^{*} & 26 & 14 \\ \hline 15 & 21 & 22 \\ \hline 16 &20 & 26 \\ \hline 17 &24& 25 \\ \hline 18^{*} &34& 18 \\ \hline 19 &15& 4 \\ \hline 20^{*} &38& 20 \\ \hline 21 &30& 31 \\ \hline \vdots &\vdots & \vdots \\ \hline \end{array}$$

$$t^{*} = z$$

Python programming for calculate $$W$$ function

n1=5
n2=77
rem_array = []
while n2 != 1:
mod = n2%n1
if mod != 0:
rem = n1-mod
n2 = n2 + rem
rem_array.append(round(rem))
n2=n2/n1
else:
n2 = n2/n1
rem_array.append(0)
print(rem_array[::-1])
print(sum(rem_array))



Proof for, if $$p>n+1$$ then $$p|S(p,n)$$

Formula

$$S(a,n)= \sum_{i=1}^{a} i^{n}=\sum_{b=1}^{n+1} \binom{a}b\sum_{j=0}^{b-1} (-1)^{j}(b-j)^{n}\binom{b-1}j$$

for formula

Proof

Let $$a=p(prime)>n+1$$

We can see, $$a$$ can be common out from $$\sum_{b=1}^{n+1}\binom{a}b\sum_{j=0}^{b-1} ...$$

$$\implies a|S(a,n)$$

Proof for, If $$p|S(p,2n)$$ Then $$W(z,W(z,S(z,2n)))=(z-1)r+1=pr+1$$

Proof

See $$S(z,2n)=pr_1+1$$

$$\implies W(z,W(z,S(z,2n)))$$ $$\ \ \ by\ identity1$$

$$=W(z,W(z,pr_1+1))$$

$$=W(z,pr_2)$$

$$=pr+1=(z-1)r+1$$

For some $$r,r_1,r_2\in\mathbb{Z}$$

I believe $$r$$ is always $$1$$ for all $$z>2n+2$$, that's my question.

Related questions on MSE

To count such $$p$$ which $$p\nmid S(p,2n)$$

Special observation on prime number and π(n)

Same question

• Your question is very interesting.It seems if b is odd positive integer,$W(11,W(11,s(11,2b)))$ always in $\{6,16,26\}$.
– Mike
Nov 29 '19 at 12:24
• @Mike Thank you for your precious time to go through and reply to me. Yes, it's really interesting and I want to know what it really is. Nov 29 '19 at 18:14
• I asked a simplified version of this question,see math.stackexchange.com/questions/3456752/…
– Mike
Nov 30 '19 at 8:37
• Another question about $W$ from same user, mathoverflow.net/questions/347796/… Dec 7 '19 at 5:36

Define $$X_a$$ be the set as, $$\{2,3,...,a-1,a\}$$

let $$D(b,m)$$ be the sum of the base-$$b$$ digits of $$m$$.

Define $$f(a,k)=\frac{D(a,a^{k+1}-S(a,k))}{a-1}$$

Theorem:

Given $$a\in \mathbb{Z}_{\ge 4}$$ and $$m\in \mathbb{Z}_{\ge 1}$$, If $$a-1\mid S(a-1,2m)$$ and $$a-1>2m+1$$ then $$(f(a,2m))_a\in X_a$$

incomplete Proof: This proof is incomplete to show $$1\notin f(a,2m)$$ but I assumed here it's true.

Clearly, we have $$(a-1)|S(a-1,2m)$$ iff $$(a-1)|D(a,S(a-1,2m))$$.

Let $$q:=\frac{D(a,S(a-1,2m))}{a-1}$$. Since for $$a\geq 4$$ and $$m\geq 1$$, $$S(a-1,2m) < (a-1)a^{2m}$$ and $$S(a,2m) = S(a-1,2m) + a^{2m}$$, we have $$D(a,S(a,2m)) = 1+q(a-1)$$. Then $$f(a,2m) = \frac{D(a,a^{2m+1} - a^{2m} - S(a-1,2m))}{a-1} \le 2m+1-q.$$

Since $$2m+1-q<2m+1, we conclude that $$(f(a,2m))_a$$ forms a single digit $$2m+1-q\geq 2$$, and thus $$(f(a,2m))_a\in X_a$$.

Corollary 1: $$W(a+1,ax+1)=a$$ if $$x\in X_{a+1}$$

Corollary 2: If $$p|S(p,2n)$$ and $$p\ge 2n+1$$ Then $$W(z,W(z,S(z,2n)))=z$$

Proof

For $$z>2n+2$$

See $$S(z,2n)=pr_1+1$$ For some $$r_1\in\mathbb{Z}$$

$$\implies W(z,W(z,S(z,2n)))$$ $$\ \ \ by\ identity1$$

$$=W(z,W(z,pr_1+1))$$

$$=W(z,pr_2)$$

Here by theorem 2 $$\implies 2\le r_2 < p$$

Hence $$W(z,pr_2)=p+1=z$$

Reference

Show that, If $a-1\mid S(a-1,2m)$ and $a-1>2m+1$ then $(f(a,2m))_a\in X_a$