Problem 303

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you are requested to be thoughtful in not posting anything that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one


See also the topics:
Don't post any spoilers
Comments, questions and clarifications about PE problems.
Post Reply
Smaug
Posts: 15
Joined: Thu Aug 06, 2009 5:08 pm

Problem 303

Post by Smaug »

Hi,
Can someone please post the sum from n = 1 to 50 of f(n)/n? I'm eight off the correct value for n = 1 to 100 :(
Thanks!
LarryBlake
Posts: 100
Joined: Sat Aug 29, 2009 8:49 pm

Re: Problem 303

Post by LarryBlake »

I get 7517.
Image
Smaug
Posts: 15
Joined: Thu Aug 06, 2009 5:08 pm

Re: Problem 303

Post by Smaug »

Ah excellent, thanks - I see where I went wrong now!
Damn you euler - you had to include f(9999) in the brief! ;) I'm going to have to rethink the way I'm doing it now.
Cerium
Posts: 8
Joined: Sun Oct 11, 2009 12:26 pm

Re: Problem 303

Post by Cerium »

Damn you euler - you had to include f(9999) in the brief!
I agree with you it would be so much easier without it, btw is it possible to find f(9999) with an "ameliorated" brute force, or that's totally impossible (and I should find a clever solution :)) ?
Image
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 303

Post by hk »

Answering your question would violate forum rules in my opinion.
Image
War ruins the life and health of untold numbers of innocent children.
poochon
Posts: 2
Joined: Wed Nov 10, 2010 1:36 am

problem 303- proof that process ends?

Post by poochon »

http://projecteuler.net/index.php?secti ... ems&id=303
i solved the problem, but i wondered if anyone has a proof that every number has a 'nice' multiple... couldn't find one myself
thanks :)
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: problem 303- proof that process ends?

Post by jaap »

From Problem 129 (View Problem):
Given that n is a positive integer and GCD(n, 10) = 1, it can be shown that there always exists a value, k, for which R(k) is divisible by n
where R(k) is the kth repunit, i.e. the number consisting of k ones.
As rathmann pointed out in the 303 forum, this shows it can be done with just ones (and possibly trailing zeroes to deal with the any factors 2 and 5) so you don't even need any twos.

Here's a quick proof:
Given any n coprime to 3.
Consider the sequence 100 mod n, 101 mod n, 102 mod n, ...
There are no more than n different values these can have, so there must be repetitions.
So 10a = 10b mod n, for some a>b.
Therefore
10a - 10b is divisible by n
Since we chose n to be coprime to 3:
(10a - 10b)/9 is divisible by n
1111...11110000...0000 is divisible by n, where there are a-b ones and b zeroes.

To deal with factors of 3, you can use the fact that if a repunit R(k) is divisible by n, then R(3k) is divisible by 3n. This is because tripling the length of a repunit R(k) is the same as multiplying by 102k+10k+1, which is a multiple of 3.
Last edited by jaap on Thu Nov 11, 2010 5:40 am, edited 2 times in total.
poochon
Posts: 2
Joined: Wed Nov 10, 2010 1:36 am

Re: Problem 303

Post by poochon »

thank you :)
jasa
Posts: 1
Joined: Mon Jan 03, 2011 2:30 am

Re: Problem 303

Post by jasa »

Regarding the numbers consisting only of nines, e.g. 9, 99, ... then
f(n) follows an interesting pattern :-) ...
I don't know if it is provable...
sinac
Posts: 2
Joined: Tue Dec 28, 2010 12:35 pm

Re: Problem 303

Post by sinac »

Hello,

Can someone please post the sum from n = 1 to 1000 of f(n)/n? I have the right answer for n=100 but for n=10000 it doesn't seem I get the correct answer but I'm almost sure my method is correct.
Or maybe someone would be kind enough to allow me to send him my result for n=9990 and n =9999 and tell me if it's correct or not ?

Thanks,

Joël
sinac
Posts: 2
Joined: Tue Dec 28, 2010 12:35 pm

Re: Problem 303

Post by sinac »

The problem was what I thought, wrong values for n = 999 and n=9999 (not the smallest possible)
Lotes
Posts: 2
Joined: Sun Jul 12, 2009 5:06 pm

Re: Problem 303

Post by Lotes »

sinac wrote:Can someone please post the sum from n = 1 to 1000 of f(n)/n?
Can someone post the answer or PM it me please :-)?
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 303

Post by hk »

Lotes wrote:
sinac wrote:Can someone please post the sum from n = 1 to 1000 of f(n)/n?
Can someone post the answer or PM it me please :-)?
I take it that you are joking.
However, there are idiots galore that would take this seriously.
So please refrain from this kind of joking.
Image
War ruins the life and health of untold numbers of innocent children.
Lotes
Posts: 2
Joined: Sun Jul 12, 2009 5:06 pm

Re: Problem 303

Post by Lotes »

mh however, you can delete the last 3 postings (including this one). i ve found my mistake. Problem solved :)
xe3tec
Posts: 46
Joined: Thu May 05, 2011 8:52 am
Location: Vienna
Contact:

Re: Problem 303

Post by xe3tec »

for 1 to 50 I get 7550...I dont see the mistake, anyone?
[(1, 2), (2, 10), (3, 12), (4, 12), (5, 10), (6, 12), (7, 21), (8, 112), (9, 12222), (10, 20), (11, 22), (12, 120), (13, 221), (14, 112), (15, 120), (16, 112), (17, 102), (18, 12222), (19, 1102), (20, 100), (21, 210), (22, 110), (23, 1012), (24, 120), (25, 100), (26, 1222), (27, 21222), (28, 112), (29, 1102), (30, 120), (31, 2201), (32, 1120), (33, 1122), (34, 102), (35, 210), (36, 22212), (37, 111), (38, 1102), (39, 10101), (40, 120), (41, 11111), (42, 210), (43, 2021), (44, 220), (45, 122220), (46, 1012), (47, 1222), (48, 1200), (49, 11221), (50, 100)]
User avatar
jaap
Posts: 588
Joined: Tue Mar 25, 2008 3:57 pm
Contact:

Re: Problem 303

Post by jaap »

xe3tec wrote:for 1 to 50 I get 7550...I dont see the mistake, anyone?
n itself is also a multiple of n (namely one times n).
xe3tec
Posts: 46
Joined: Thu May 05, 2011 8:52 am
Location: Vienna
Contact:

Re: Problem 303

Post by xe3tec »

edit: got it
whakamaru
Posts: 47
Joined: Thu May 06, 2010 11:08 pm

Re: Problem 303

Post by whakamaru »

jasa wrote:Regarding the numbers consisting only of nines, e.g. 9, 99, ... then
f(n) follows an interesting pattern :-) ...
I don't know if it is provable...
f(n)/n also follows a predictable pattern for the 9's, there might be a function that gives f(n)/n for these numbers?
Post Reply