Thread: Palindromic numbers

  1. #1
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787

    Palindromic numbers

    I've been revisiting some of the Project Euler problems that I skipped because I wasn't motivated at the time =)

    Anyway, problem #4 is called "Largest palindrome product":

    A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99.
    Find the largest palindrome made from the product of two 3-digit numbers.
    Source: Problem 4 - Project Euler


    I have a solution and have calculated the largest products for the products of 2-, 3-, 4-, 5-, 6-, and 7-digit numbers. And I get the sequence below (starting from the largest for 4-digit numbers so I don't give the answer to the question from Project Euler.

    9999 * 9901 = 99000099
    99979 * 99681 = 9966006699
    999999 * 999001 = 999000000999
    9999979 * 9467731 = 94677111177649

    This sequence (of the results) doesn't seem to be a named sequence. Is it too boring? Surely there must be a sequence or related sequence... I'm sure there are more obscure sequences than this one that are listed on, for example, on oeis.org.

    My solution is still brute force and that makes me uneasy but I can't seem to get my lightbulb to light.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Location
    Toronto, Canada
    Posts
    1,834
    There exists a larger palindrome product of two 7-digit numbers:

    9998017 * 9997647 = 99956644665999

    8-digit:
    99999999 * 99990001 = 9999000000009999

    9-digit:
    999980347 * 999920317 = 999900665566009999

    10-digit:
    9999999999 * 9999900001 = 99999000000000099999
    Last edited by nonoob; 12-19-2013 at 01:01 PM.

  3. #3
    and the hat of copycat stevesmithx's Avatar
    Join Date
    Sep 2007
    Posts
    587
    Quote Originally Posted by Hodor View Post
    My solution is still brute force and that makes me uneasy but I can't seem to get my lightbulb to light.
    There is a forum in Project Euler that opens up after you solve the problem. It has several interesting ways people used to solve the problem. For this particular problem, I could see many interesting solutions, some not using a computer at all.

  4. #4
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    In other news, through some guesswork and playing around, I figured out Euler 5 on paper before I ever wrote an algorithm for it so now I would essentially have to work backwards.
    Granted, it is probably an easier problem than this one.
    I wonder if the site accepts functions that do no calculations at all.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Palindromic String
    By Laika1986 in forum C Programming
    Replies: 2
    Last Post: 10-29-2011, 12:48 PM
  2. Palindromic numbers problem
    By deadrabbit in forum C Programming
    Replies: 1
    Last Post: 09-27-2011, 08:11 PM
  3. Undefined Behaviour (Palindromic Number Finder)
    By pobri19 in forum C++ Programming
    Replies: 12
    Last Post: 09-28-2008, 04:54 AM
  4. checking if binary numbers are palindromic
    By Beatz in forum C Programming
    Replies: 3
    Last Post: 01-24-2008, 01:49 PM
  5. Comparing numbers to a list of numbers held in a text file
    By jmajeremy in forum C++ Programming
    Replies: 3
    Last Post: 11-06-2006, 07:56 AM