Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Project Euler Question 104
Index -> General Programming
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Panphobia




PostPosted: Wed Dec 26, 2012 5:38 pm   Post subject: Project Euler Question 104

For question 104 in project euler they are asking to see when a fibonacci number starts and ends in a pandigital sequence, so the beginning is 1-9 and the end is 1-9, what i thought of doing what using the fibonacci sequence Fk = Fk-1+Fk-2 % (anything past the last nine digits) to see if the last nine digits are pandigital, and using binets formula to generate the first 9 numbers by doing Math.floor(Fk/(what ever is past the 9th number)) and then seeing if they are both pandigital and then moving on to the next until you find it, my trouble is with finding what to mod and divide by, could I calculate the numbers in a biginteger and then make it a string and substring the first nine and last nine, or is there a way to calculate what you need to divide and mod it by?
Sponsor
Sponsor
Sponsor
sponsor
A.J




PostPosted: Wed Dec 26, 2012 5:42 pm   Post subject: RE:Project Euler Question 104

Notice that the last k digits of a number is the remainder you get when you divide that number by 10^k. Something similar could be applied for getting the first 9 digits.
Panphobia




PostPosted: Wed Dec 26, 2012 5:43 pm   Post subject: RE:Project Euler Question 104

ahhh thanks AJ Smile
QuantumPhysics




PostPosted: Wed Dec 26, 2012 11:06 pm   Post subject: RE:Project Euler Question 104

Did you solve it or do you still need help?
Panphobia




PostPosted: Thu Dec 27, 2012 12:50 am   Post subject: RE:Project Euler Question 104

Solved but thanks
Display posts from previous:   
   Index -> General Programming
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: