wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> medium >> Digit sum of three consecutive numbers
(Message started by: Christine on Mar 19th, 2013, 10:38am)

Title: Digit sum of three consecutive numbers
Post by Christine on Mar 19th, 2013, 10:38am
Is there a method to finding a positive integer x such that each of DigitSum(x), DigitSum(x-1) and DigitSum(x+1) is divisible by a certain prime number?

Say the prime number is 7 or 17, how to find the smallest integer x?


Title: Re: Digit sum of three consecutive numbers
Post by towr on Mar 19th, 2013, 11:11am
Either ds(x-1) and ds(x), or  ds(x) and ds(x+1) are consecutive numbers; so they can't be divisible by the same number (>1).

Title: Re: Digit sum of three consecutive numbers
Post by pex on Mar 19th, 2013, 11:15am

on 03/19/13 at 10:38:59, Christine wrote:
Is there a method to finding a positive integer x such that each of DigitSum(x), DigitSum(x-1) and DigitSum(x+1) is divisible by a certain prime number?

Say the prime number is 7 or 17, how to find the smallest integer x?

If I understand the question correctly, this does not seem possible. At least one of the differences DigitSum(x)-DigitSum(x-1) and DigitSum(x+1)-DigitSum(x) is going to be 1, so those two digit sums will be coprime.

Edit: not fast enough...

Title: Re: Digit sum of three consecutive numbers
Post by Christine on Mar 19th, 2013, 12:02pm
Sorry I got it wrong.

This is what I found so far:

It is possible to find 3 consecutive integers such two of them have their digitsum divisible by a certain prime p and other integer divisible by the same prime p.

For example,
156999, 157000 and 157001

DigitSum(156999) = 1+5+6+9+9+9 = 39 = 3*13
DigitSum(157000) = 1+5+7+0+0+0 = 13
157001 = 13 * 12077


I don't whether this is a known or perhaps interesting result. And how to explain this?

But I find it very cool.

Title: Re: Digit sum of three consecutive numbers
Post by pex on Mar 19th, 2013, 12:25pm
Aha. Barring errors in my program that took all of two minutes to write, the smallest triple for p=7 is
DigitSum(609999) = 42 = 6*7
DigitSum(610000) = 7
610001 = 87143*7.
I don't really have a better method than brute-force searching over multiples of p that end in 1, though. Of course it'd be much faster to generate the middle number directly and check x+1 for divisibility. If a solution for p=19 exists, its middle number is going to end in at least 17 zeros, because that's the smallest integer for which 9k-1 is divisible by 19.

For p=17:
DigitSum(17899) = 34 = 2*17
DigitSum(17900) = 17
17901 = 1053*17

Title: Re: Digit sum of three consecutive numbers
Post by towr on Mar 20th, 2013, 12:22am
Then for 19, I'd say
19899999999999999999 => 9*19
19900000000000000000 => 19
19900000000000000001 = 1047368421052631579*19

However, I don't think it was Christine's intent that it's necessarily the first two where you take the digit sum. So you might get a smaller result by taking the digit sum of the first and last, or the last two.

Title: Re: Digit sum of three consecutive numbers
Post by pex on Mar 20th, 2013, 12:30am

on 03/20/13 at 00:22:31, towr wrote:
However, I don't think it was Christine's intent that it's necessarily the first two where you take the digit sum. So you might get a smaller result by taking the digit sum of the first and last, or the last two.

I had convinced myself that that couldn't happen last night, but I don't recall why, and it's not making much sense now that it's morning. So... you're probably right.

Title: Re: Digit sum of three consecutive numbers
Post by towr on Mar 20th, 2013, 10:20am
For example:
ds(419) = 2*7
420 = 10*7
ds(421) = 1*7

Title: Re: Digit sum of three consecutive numbers
Post by Christine on Mar 20th, 2013, 5:18pm

on 03/20/13 at 10:20:44, towr wrote:
For example:
ds(419) = 2*7
420 = 10*7
ds(421) = 1*7


Nice! is the triplet (419, 420, 421) the smallest divisible by 7?

what are the smallest four consecutive integers with the same property?

Title: Re: Digit sum of three consecutive numbers
Post by pex on Mar 21st, 2013, 12:26am

on 03/20/13 at 17:18:52, Christine wrote:
Nice! is the triplet (419, 420, 421) the smallest divisible by 7?
Yes. This time I simply checked all triplets starting at (1,2,3) to be sure. 8)


on 03/20/13 at 17:18:52, Christine wrote:
what are the smallest four consecutive integers with the same property?
Can there be any? Out of those four, only one can be divisible by 7, so three would need to have digit sums divisible by 7. But at least two of these three have the same digits except for the least significant place, which cannot differ by 7 either.

Title: Re: Digit sum of three consecutive numbers
Post by ravibhole_1 on Apr 7th, 2013, 9:53am
It is not possible



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board