Problem 710

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
Ted
Posts: 20
Joined: Sun Apr 02, 2006 10:46 pm

Problem 710

Post by Ted »

Problem 710 (View Problem)
If palindrome elements have more than one digit, can they occupy the center of a tuple, for example, (2,16,2) could be a twopal for 20? What about (4,12,4)? Would that be a twopal? What about (20)?

wrongrook
Posts: 403
Joined: Sat Oct 17, 2009 10:39 pm

Re: Problem 710

Post by wrongrook »

(2,16,2) is a twopal for 20 (tuple is palindromic and 2 is present).

(4,12,4) is not (no element equal to 2).

(20) is not (no element equal to 2).

In Python, a test for a twopal could be written as:

Code: Select all

A=(2,16,2)
is_twopal = (A == A[::-1]) and (2 in A)

Post Reply