All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars    
perplexus dot info

Home > Numbers
Consecutive Near Palindromes (Posted on 2008-02-13) Difficulty: 3 of 5
Find a set of four consecutive six digit numbers which satisfies the following:
  • The last four digits of the first (smallest) number form a palindrome.
  • The last five digits of the second number form a palindrome.
  • The second through fifth digits of the third number form a palindrome.
  • The fourth (largest) number is a palindrome.

See The Solution Submitted by Brian Smith    
Rating: 3.3333 (3 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
Solution Two Solutions Comment 9 of 9 |
198888 198889 198890 198891
199999 200000 200001 200002

for n in range(100000, 999997):
    first = str(n)
    second = str(n+1)
    third = str(n+2)
    fourth = str(n+3)
    if first[2]==first[5] and first[3]==first[4]:
        if second[1]==second[5] and second[2]==second[4]:
            if third[1]==third[4] and third[2]==third[3]:
                if fourth[0]==fourth[5] and fourth[1]==fourth[4] and fourth[2]==fourth[3]:
                    print(n,n+1,n+2,n+3)

  Posted by Larry on 2023-02-28 08:39:35
Please log in:
Login:
Password:
Remember me:
Sign up! | Forgot password


Search:
Search body:
Forums (0)
Newest Problems
Random Problem
FAQ | About This Site
Site Statistics
New Comments (6)
Unsolved Problems
Top Rated Problems
This month's top
Most Commented On

Chatterbox:
Copyright © 2002 - 2024 by Animus Pactum Consulting. All rights reserved. Privacy Information