# Checking a Number for Palindromic Behavior

Ethan Furman ethan at stoneleaf.us
Mon Oct 19 22:29:52 CEST 2009

```rurpy at yahoo.com wrote:
> On Oct 19, 12:41 pm, Ethan Furman <et... at stoneleaf.us> wrote:
>
>>gslindstrom wrote:
>>
>>>On Oct 18, 5:56 pm, Gary Herron <gher... at digipen.edu> wrote:
>>
>>>>Benjamin Middaugh wrote:
>>
>>>>>Thanks to everyone who helped with my query on reversing integers. I
>>>>>have one more simple problem I'm having trouble solving. I want to
>>>>>check a number for palindromic behavior (reading the same backwards
>>>>>and forwards). So if I have an integer 1457 it can tell me this is not
>>>>>the same from both ends but 1551 is. I think the simplest way would be
>>>>>to work inwards from both ends checking digits for equality, but I
>>>>>don't know enough (yet) to do this.
>>
>>>>>All help is much appreciated.
>>
>>>>>Benjamin
>>
>>>>This problem (and the OP's previous problem) are probably homework
>>>>problems.   If so, it was unethical for the student to ask for a
>>>>solution here, and it was careless of several responders to provide a
>>>>solution.   Let's not make the same mistake this time.
>>
>>>>Gary Herron
>>
>>>Could be.  Or, like me, they could be working the Project Euler
>>>problems.  IIRC, many of the solutions involve checking for this type
>>>of thing.  I'd like to see the OP's work before we give our solutions,
>>>though.
>>
>>>--greg
>>
>>Absolutely.  I have no issues asking for or receiving help for
>>apparently simple problems, but a description of what has been tried,
>>preferably with code snippets and results, should be included with the
>>request.
>>
>>~Ethan~
>
>
> I agree such info *should* be included, but if it is
> I can answer without such info, I will do so (although
> perhaps while mentioning that the next time including
> such info would be helpful, if no one else had pointed
> this out.)  People in this group can be pissy enough
> without my adding to it by insisting a poster jump
> though some hoops before I'll spend my precious time
> is not only to the benefit of the questioner, but
> also to the benefit of many other silent readers
> who shouldn't be penalized due to the faults of the
> questioner.

Your arguments are most persuasive.  Consider me convinced.

Even if the worst-case scenario is true (homework problem, ack!), either
the poster will learn from the answer in which case all is well, or the
poster will not, in which case the final exam will show it.

~Ethan~

```