Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Project Euler Question 104
Author Message
Panphobia

Posted: 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?

A.J

Posted: 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

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

ahhh thanks AJ
QuantumPhysics

Posted: 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

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

Solved but thanks
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 5 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: