Problem 097

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
Phibonacci
Posts: 10
Joined: Fri Nov 28, 2008 4:04 am
Location: Des Moines, IA
Contact:

Problem 097

Post by Phibonacci »

Is the number like this:
28433×(27830457+1)
or:
(28433×27830457)+1
Phibonacci - A juxtaposition of Phi (The Golden Ratio) and Fibonacci (Leonardo of Pisa)
User avatar
Tommy137
Posts: 238
Joined: Sun Feb 24, 2008 6:02 pm
Location: Cologne, Germany
Contact:

Re: Problem 097

Post by Tommy137 »

Phibonacci wrote:Is the number like this:
28433×(27830457+1)
or:
(28433×27830457)+1

(28433×27830457)+1 is correct.
Image
JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Problem 97

Post by JMW1994 »

Is 28433×27830457+1 calculated like this (28433×27830457)+1 or 28433×(27830457+1)? It appears that either way, I can't get to the correct answer. The fastest way is to only focus on the last 10-20 digits rather than the 2,000,000+ number as a whole.
Image
TripleM
Posts: 384
Joined: Fri Sep 12, 2008 3:31 am

Re: Problem 97

Post by TripleM »

If it were the latter, it wouldn't exactly be a prime, would it? :)
JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 97

Post by JMW1994 »

<snip>
Is it possible to even calculate +2,000,000 digits with an array or linked list?
Last edited by JMW1994 on Sun Nov 13, 2011 2:47 am, edited 1 time in total.
Image
User avatar
elendiastarman
Posts: 410
Joined: Sat Dec 22, 2007 8:15 pm

Re: Problem 97

Post by elendiastarman »

JMW1994, one would think that having been on this forum for several months and posting 28 other times, you should know not to post any results or code, whole or fragmented. In addition, you should also know that this is a public forum. Hence, can you remove your results?
Want some
3.14159265358979323846264338327950288419716939937510
58209749445923078164062862089986280348253421170679...?
Image
JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 97

Post by JMW1994 »

Okay, they weren't right though. However, can one actually calculate a +2,000,000 digit through an array or linked list?
Image
mynameisalreadytaken
Posts: 20
Joined: Sun Sep 25, 2011 11:20 pm

Re: Problem 97

Post by mynameisalreadytaken »

It's surely possible - with an arbitrary precision library you could calculate all digits of the number. But this is absolutely not necessary.
Image
JMW1994
Posts: 43
Joined: Sat Apr 09, 2011 11:35 pm

Re: Problem 97

Post by JMW1994 »

mynameisalreadytaken wrote:It's surely possible - with an arbitrary precision library you could calculate all digits of the number. But this is absolutely not necessary.
I already knew that as I already programmed an arbitrary precision library(I call it "system" instead) but maybe it was how the order of 28433×27830457+1 went.

EDIT: Solved it. Had to do with something in the library that I wrote up.
Image
marvin
Posts: 3
Joined: Sat Jan 05, 2013 11:59 am

Re: Problem 097

Post by marvin »

Hi,
I have a BigInt class in C#, but it calculates powers up to ~5000.
So I decided (for this question) to treat every number >10^10 as its last 10 digits, and multiply that (max. 10 digit) number by 2 to get the next power.

is this approach true? I mean I think it would be true , but in the end, I got the last 10 digits and multiply that number by 28433 and added 1. But the answer is not correct.
So what's wrong with this solution?
thundre
Posts: 356
Joined: Sun Mar 27, 2011 10:01 am

Re: Problem 097

Post by thundre »

marvin wrote:So what's wrong with this solution?
Does the end result have more than 10 digits? If so, you should drop some, because the problem only asks for 10.
Image
marvin
Posts: 3
Joined: Sat Jan 05, 2013 11:59 am

Re: Problem 097

Post by marvin »

thundre wrote:
marvin wrote:So what's wrong with this solution?
Does the end result have more than 10 digits? If so, you should drop some, because the problem only asks for 10.
Yes, I entered the last 10 digits of the result.
Apparently something wrong with my program.
marvin
Posts: 3
Joined: Sat Jan 05, 2013 11:59 am

Re: Problem 097

Post by marvin »

Omg,
I gave up that one and tried another solution, which failed again:

I tried to find a pattern, and discovered that the last 2 digits of powers of two repeat themselves in every 20th power.
So I got (28433 % 20) , and the corresponding two digit number, multiplied that with 220, multiplied by 28433, added 1, and... wrong!

somebody please give a clue where am I doing wrong?

edit: oops, I understood what's wrong with my second solution. gotta find a bigger-digit pattern. :)

edit 2 : found the bigger pattern, still wrong.. this question is gonna drive me crazy..
User avatar
TheEvil
Posts: 84
Joined: Sun Nov 13, 2011 10:38 am
Location: Szeged, Hungary

Re: Problem 097

Post by TheEvil »

If you were asked the last two digit of this number, your answer would almost be good. But you have to calculate
(28433%100) × 27830457%20 + 1
and of course at the end, the last two digit of that number. Anyway the problem is solvable without bigintegers (as all the others I have done yet).
Image
User avatar
rayfil
Administrator
Posts: 1412
Joined: Sun Mar 26, 2006 5:30 am
Location: Quebec, Canada
Contact:

Re: Problem 097

Post by rayfil »

marvin

Just make sure you multiply by 2 the correct number of times. Try your algo with a smaller power (such as 4321) and see how it checks with the result you would get with your BigInt class.
When you assume something, you risk being wrong half the time.
hkapur97
Posts: 1
Joined: Thu Jan 10, 2013 12:37 pm
Location: India

Re: Problem 097

Post by hkapur97 »

This problem can be done by hand if you're very good with [modular arithmetic](en.wikipedia.org/wiki/Modular_arithmetic)
Never give up.
Post Reply