Problem 549

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
essjayarr
Posts: 2
Joined: Sat Mar 19, 2016 9:28 am

Problem 549

Post by essjayarr »

Hi!

Can someone point out after which n in the list below my answers starts going wrong?
I'm hoping that'll help me find out why it isn't right.

n — S (n)
<values snipped by moderator>
Thanks.
SJR.
square1001
Posts: 27
Joined: Tue Mar 15, 2016 2:58 am
Location: Tokyo, Japan
Contact:

Re: Problem 549.

Post by square1001 »

Let's calculate for a brute-force code and check for small $n$ cases.
Image
essjayarr
Posts: 2
Joined: Sat Mar 19, 2016 9:28 am

Re: Problem 549

Post by essjayarr »

Thanks! That helped.

Evidently, I wasn't paying attention to 12 being divisible by 4 :-(

regards,
Janakiraman.
Alex-82w4
Posts: 20
Joined: Fri Jan 13, 2017 4:37 pm

Re: Problem 549

Post by Alex-82w4 »

It is impossible to solve this problem by calculating the most factorials directly.

My approach to find the number of common divisors for the smallest divisor and factorial.
I used Legendre's Theorem to do the trick for factorials.
My program runs quickly and correctly for n = 100.
I improved processing time for the first 10000 numbers from 5 minutes to 2 seconds :shock: Processing time of the next sequential 10000 records increases exponentially. I ran the program for a day and it calculated S(2160000). I don't know how long it takes to get result for S(108) I guess it is more than a week.

Could someone help me to improve performance of my existing program?

Thanks,
Alex.
Image
The friend key is 1004797_CkgowZqfFi0qQMGOqVjB0RP8htEhkWW2
vamsikal3
Posts: 89
Joined: Sat Oct 01, 2016 9:25 am

Re: Problem 549

Post by vamsikal3 »

<deleted post>
Last edited by vamsikal3 on Fri Nov 27, 2020 3:09 am, edited 1 time in total.
my friend key --> 990813_OZPwQtCjkD6KlvxirOoTSZxccMFsuw1L
Image
tigershark22
Posts: 1
Joined: Tue Jun 09, 2015 1:34 am

Re: Problem 549

Post by tigershark22 »

I'm having a problem with my S(n) function. I calculated for the values of s(n) given and can't find what's wrong. S(100) gives me 2034 instead of 2012. Can someone tell me what numbers my s(n) is off for? (pm me)

EDIT: Never mind, I need to change my program for those special cases
EDIT 2: I think there's something wrong with my algorithm still, now im getting 1967. Please pm me
LateStart
Posts: 10
Joined: Sat Oct 07, 2017 4:59 pm

Re: Problem 549

Post by LateStart »

Hello,

I'm having problems understanding the question for problem 549.

S(100)=2012.

Does that mean that smallest factorial divisible by 100 and greater than 100 is 2012!?
What I have found is 300! % 100 ==0.

Can someone explain to me what exactly are we searching for, because it looks like I have misunderstood the question.
Image
traxex
Posts: 66
Joined: Thu Oct 19, 2017 1:30 pm

Re: Problem 549

Post by traxex »

LateStart wrote: Wed Nov 15, 2017 8:15 pm S(100)=2012.

Does that mean that smallest factorial divisible by 100 and greater than 100 is 2012!?
No. It means that s(2) + s(3) + ... + s(100) = 2012.
Technically, everyone is full of himself.
LateStart
Posts: 10
Joined: Sat Oct 07, 2017 4:59 pm

Re: Problem 549

Post by LateStart »

Thank you, so to double check if I got this right this time..
We have to find the sum of all the smallest divisors, for factorials from 2 to 100 in case s(100)=2012?
Image
traxex
Posts: 66
Joined: Thu Oct 19, 2017 1:30 pm

Re: Problem 549

Post by traxex »

LateStart wrote: Wed Nov 15, 2017 8:38 pm We have to find the sum of all the smallest divisors, for factorials from 2 to 100 in case s(100)=2012?
You have it exactly backwards. You are not looking for divisors, they are what is given; you are looking for the smallest factorials that are divisible by the given divisors.

Also note that s(n) and S(n) are different functions. It is the upper case version for which S(100) = 2012.

I suggest you create brute force implementations of s(n) and S(n) and verify the example values given.
Last edited by traxex on Wed Nov 15, 2017 8:58 pm, edited 1 time in total.
Technically, everyone is full of himself.
LateStart
Posts: 10
Joined: Sat Oct 07, 2017 4:59 pm

Re: Problem 549

Post by LateStart »

Oh, I got it now because I didn't spot the S and s difference in the first place. Thank you for clarifying this :)
Image
LateStart
Posts: 10
Joined: Sat Oct 07, 2017 4:59 pm

Re: Problem 549

Post by LateStart »

Hello,

I think I might have managed to "solve" the problem, but before letting it run (aprox time required 50 hours), I need to be sure that solution is 100% correct.
I have calculated S(2000000) in 1 hour. Really takes too long for large numbers, and it isn't pure brute force solution. I have implemented Kempners function rules, but it still has to check factors for each number except primes.

So please, before I start on any algorithm improvements, can anyone confirm if S(<snipped by moderator>) = <snipped by moderator>?

Regards,
LateStart
Image
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 549

Post by hk »

Asking for answer confirmations to enable a bruteforce solution is not the purpose of this forum.
Image
War ruins the life and health of untold numbers of innocent children.
LateStart
Posts: 10
Joined: Sat Oct 07, 2017 4:59 pm

Re: Problem 549

Post by LateStart »

I understand your point, but the last thing I am trying to do is cheat ;)
I'm not going to brute force it. Just not sure if rules I've implemented are correct and do apply correctly for larger numbers than 100.
Image
User avatar
hk
Administrator
Posts: 12832
Joined: Sun Mar 26, 2006 10:34 am
Location: Haren, Netherlands

Re: Problem 549

Post by hk »

I program that will take 50 hours to run is a classical example of bruteforcing.
Please find a solution that runs fast enough.
Image
War ruins the life and health of untold numbers of innocent children.
LateStart
Posts: 10
Joined: Sat Oct 07, 2017 4:59 pm

Re: Problem 549

Post by LateStart »

I have solved problem in 90 minutes, and I do not consider it bruteforce. As i got very interested into solving this problem, if anyone could check the code, I've posted it on thread page comments, and explain to me why it takes so long for above 10^7 calculations.
Image
User avatar
Animus
Administrator
Posts: 1987
Joined: Sat Aug 16, 2014 1:23 pm

Re: Problem 549

Post by Animus »

Answered via PM.
merlinnimue
Posts: 4
Joined: Sun Aug 28, 2016 4:27 pm

Re: Problem 549

Post by merlinnimue »

Quick sanity check: can anyone confirm if S(10^6) = skipped?
Image
MuthuVeerappanR
Posts: 539
Joined: Sun Mar 22, 2015 2:30 pm
Location: India
Contact:

Re: Problem 549

Post by MuthuVeerappanR »

merlinnimue wrote: Mon Apr 30, 2018 6:08 pm Quick sanity check: can anyone confirm if S(10^6) =xxxxxxxxxxxxxxx?
We are not supposed to post partial answers in this forum. But anyway, the value you posted seems to be wrong. Happy solving!!
Image
It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment.
merlinnimue
Posts: 4
Joined: Sun Aug 28, 2016 4:27 pm

Re: Problem 549

Post by merlinnimue »

MuthuVeerappanR wrote: Mon Apr 30, 2018 6:49 pm
merlinnimue wrote: Mon Apr 30, 2018 6:08 pm Quick sanity check: can anyone confirm if S(10^6) = wrong?
We are not supposed to post partial answers in this forum. But anyway, the value you posted seems to be wrong. Happy solving!!
My apologies -- I thought this was something of a common practice judging from other posts. Thanks for your help!
Image
Post Reply