Digital sum

The digital root of a number is obtained by adding together the digits of that number, and repeating that process until a number is arrived at that is less than 10 10 .

For example,for 29953 29953 the digital root is 29953 28 10 1 29953 \rightarrow 28\rightarrow 10\rightarrow 1 .

Let S S be the number of all positive integers less than one million that have a digital root of 1 1 . What is the digital root of S S ?

Check out part 2 for a more challenging version


The answer is 6.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

5 solutions

Maryam Malik
Apr 6, 2014

Digital root of S is congruent to S mod 9. So no.of no.s less than 1 million which are 1 mod 9 are 1000000 1 9 \frac{1000000-1}{9} = 111111 =S which is congruent to 6 mod 9.

Whoa. That's so simple enough. Thank you!

Joeie Christian Santana - 7 years, 2 months ago
Arya Samanta
Apr 6, 2014

Quite easy!!! The first no. which has digital root of 1 is 1, THEN onwards every 9th no. has a digital root of 1 (Example : 1,10,19,28...) SO..... the last no. is 1000000. it makes up 111111 terms in all..
So the digital root of this no. is 6.. _:) _

Nanda Khoyri
May 6, 2014

Here is my solution in Matlab

function main

clear all close all clc

s=0; for i = 1:999999 if(digitalroot(i)==1) s=s+1; end end

s

a=digitalroot(s)

end

function y=digitalroot(i) while(i>=10) d(1)=floor(i/1e6); d(2)=mod(floor(i/1e5),1e1); d(3)=floor(mod(i,1e5)/1e4); d(4)=floor(mod(i,1e4)/1e3); d(5)=floor(mod(i,1e3)/1e2); d(6)=floor(mod(i,1e2)/1e1); d(7)=mod(i,1e1); i=sum(d); end y=i; end

Sanjay Kamath
Apr 19, 2014

Here is my solution in c#

private void GetDigitalSum(double num, ref double num2)
    {
        //digital sum

        double sum = 0;

        for (int r = 0; r <= num.ToString().Length - 1; r++)
        {
            sum += double.Parse(num.ToString().Substring(r, 1));

        }

        if (sum.Equals(1))
        {
            num2 = -8;
            return;
        }
        else
        {
            if (sum > 9)
            {
                GetDigitalSum(sum, ref num2);
            }
            else
            {
                num2 = sum;
            }
        }


    }

  Here is the calling subroutine.

   double no = 1;
        double no2 = 0;
        double sumr = 0;
        double sumc = 0;

        ArrayList ar = new ArrayList();

        while (no < 1000000)
        {
            Application.DoEvents();
            lblCounter.Text = no.ToString();

            GetDigitalSum(no, ref no2);

            if (no2.Equals(-8))
            {
                ar.Add(no);
                sumr += double.Parse(no.ToString());
            }

            no += 1;
        }


        GetDigitalSum(ar.Count, ref no2);

        MessageBox.Show(no2.ToString());

       Answer : 6
Mark Mottian
Apr 15, 2014

Here is a programming solution in Python.

count = 0

def digitalRoot(n): #This function calculates the digital root
    Sum = 0

    while 1:
        while n > 0:
            Sum = Sum + (n%10)
            n = n/10

        if Sum >= 10:
            n = Sum
            Sum = 0
        else:
            return Sum
            break

#Now loop through all numbers less than a million and find those where digital root = 1
for x in xrange(1, 1000000):          
    if digitalRoot(x) == 1:
        count = count + 1

print digitalRoot(count)

The programme returns 6 as the answer.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...