n-ary representation and divisibility




Recently I have an observation about algorithms on divisibility of
integers by prime numbers. People have developed many of these, e.g.

(1)For p=3: add up all digits and see if the sum divides by 3.

(2)For p=7:split the digits two by two from the leftmost digit; then 2
times the leftmost group and add on the second leftmost group, and so
on, till see if the sum divides by 7.

(3)For p=11: split the digits two by two from the leftmost digit;
them add the leftmost group on the second leftmost group, so on, till
see if the final sum divides by 11.

But we perform all these algorithms mostly under decimal representation
of the integer. What about for different n-ary representation?

I find that: For integer a and fixed prime p, if we write a into m-ary
representation, where m and 10 are congruent mod p, then the same
algorithm that works under decimal representation, could still applies
for m-ary representation of a. I've checked tens of numbers and the
first several primes, and the conclusion goes true, but i dont know how
to prove it or disprove it.

Could anyone help me?

.



Relevant Pages

  • Re: n-ary representation and divisibility
    ... > times the leftmost group and add on the second leftmost group, ... > But we perform all these algorithms mostly under decimal representation ... What about for different n-ary representation? ... > for m-ary representation of a. ...
    (sci.math)
  • Re: Gentler Decimal Floating-Point
    ... effectively change the radix of a decimal floating point ... under the heading "Logarithms all the time", ... logarithmic representation of numbers to be made workable for all the ... The middle digits are shifted only when the exponent, ...
    (comp.arch.arithmetic)
  • Re: Smart number formatting
    ... but a highly unlikely scenario in this program. ... anything the user inputs after the 8th decimal point renders ... > I have also considered counting the number of digits the user inputs to ... representation of a float or double. ...
    (comp.lang.java.help)
  • REPOST: Re: observation on NAF
    ... > There is a neat trick for constructing the wNAF that you might find ... > binary representation by doing a digitwise subtraction of n from 2n ... > digits as the w-NAF and has the same under of nonzero digits. ... My hunch is the density isn't as low as they suspect or my naf ...
    (sci.crypt)
  • REPOST: Re: observation on NAF
    ... > There is a neat trick for constructing the wNAF that you might find ... > binary representation by doing a digitwise subtraction of n from 2n ... > digits as the w-NAF and has the same under of nonzero digits. ... I used the trick of generating the digits right-to-left using the ...
    (sci.crypt)