About digits sum and divisibility

elementary-number-theorynumber theory

Let $D$ be the function define as $D(b,n)$ be the sum of the base-$b$ digits of $n$.

Example: $D(2,7)=3$ means $7=(111)_2\implies D(2,7)=1+1+1=3$

Define $S(a,m)=1^m+2^m+3^m+…+a^m$ where $a,m\in\mathbb{Z}_+$


Edit:Update claim

For $m$ is every positive integer. How do you show that

If $a\nmid S(a-1,m)$

Then $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))=(a-1)(m+1)$?

And

If $a\mid S(a-1,m)$

Then $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))\ne(a-1)(m+1)$?

Source code

n1= 2
o = 1
while n1 < 100:
    m = 2
    print("\n n1=",n1)
    #print("m=",m)

    num=n1
    sum_num = 0

    for i in range(1, num): 
        sum_num += i**(m)
    n2 = (sum_num)

    if(n2%num == 0):
        print("div & sum=",n2)
    else:
        print("not div & sum=",n2)



    rem_array = []
    while n2 != 0:
        mod = n2%n1
        if mod != 0:
          rem = mod
          n2 = n2 - rem
          rem_array.append(round(rem))
          n2 = n2/n1
        else:
            n2 = n2/n1
            rem_array.append(0)

    print(rem_array[::-1],sum(rem_array))
#    print(sum(rem_array))

    n2=(sum_num)+n1**m
    rem1_array = []
    while n2 != 1:
        mod = n2%n1
        if mod != 0:
          rem1 = n1-mod
          n2 = n2 + rem1
          rem1_array.append(round(rem1))
          n2 = n2/n1
        else:
            n2 = n2/n1
            rem1_array.append(0)
#   print(rem_array)
    print(rem1_array[::-1],sum(rem1_array))
    if((n1-1)*(m+1) == sum(rem_array)+sum(rem1_array)):
        print("oooooooooook")
    print("(a-1)(m+1)=",(n1-1)*(m+1))



    n1 += o

Update claim helps to show below claim

For $m$ is even positive integer. How do you show that

If $(a-1)\mid S(a-1,m)$

Then $D(a,a^{m+1}-S(a,m))+D(a,S(a-1,m))=(a-1)(m+1)$?


We can easily prove for every prime$-p>m+1$ is $p\mid S(p,m)$

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)$

Best Answer

Your equation $D(a,a^{m+1} - S(a,m)) + D(a,S(a-1,m)) = (a-1)(m+1)$ is not always true when $(a-1) \mid S(a-1,m)$.

For example, take $a=4$, $m=3$. $S(3,3) = 1^3 + 2^3 + 3^3$ is divisible by $3$, but $D(4,4^4 - S(4,3)) + D(4,S(3,3)) = 6+3=9$ while $(4-1)(3+1) = 12$.

Related Question