Re: n-ary representation and divisibility



krill wrote:
> 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.
>
Let a = a_k m^k + a_{k-1} m^{k-1} + ... + a_1 m + a_0 and suppose
that a* = a_k 10^k + a_{k-1} 10^{k-1} + ... + a_1 10 + a_0.
By assumption, a = a* (mod p) - so a is divisible by p if and
only if a* is. That proves your claim -- note also that there's
no particular need to assume that p is prime ...

> Could anyone help me?

.



Relevant Pages

  • n-ary representation and divisibility
    ... add up all digits and see if the sum divides by 3. ... times the leftmost group and add on the second leftmost group, ... But we perform all these algorithms mostly under decimal representation ...
    (sci.math)
  • Re: n-ary representation and divisibility
    ... >Recently I have an observation about algorithms on divisibility of ... >But we perform all these algorithms mostly under decimal representation ... What about for different n-ary representation? ... The reason why a number in decimal form is divisible by 3 iff the sum ...
    (sci.math)
  • Re: hi everyone, i had s.ome questions about holographic information
    ... post-offset need to be stored for each base representation, ... i've not come across any algorithms like it, but as i can just see it ... To have a stream type compression with advanced algorithms (even ... since in this analogy the data set size is only limited by the memory ...
    (comp.compression)
  • Representation of Triangle Meshes
    ... i'm currently searching for an adequate representation of triangle ... I know that the choice of representation heavily depends on the ... * meshes as indexed face lists stores pointers ... A lot of algorithms I deal with require fast access for neighborhood ...
    (comp.graphics.algorithms)
  • Re: Little Endian -> Big Endian (Ada95 / GNAT), Whats with floating point types?
    ... The OP was converting out of and back into the same representation. ... The algorithms were both published in Proceedings of the ACM SIGPLAN ... How to Print Floating Point Numbers Accurately. ... You can find free implementations of these algorithms in C at ...
    (comp.lang.ada)