PalindromeQ

PalindromeQ[list]

returns True if the given list is identical to Reverse[list], and False otherwise.

PalindromeQ[n]

returns True if the integer n is identical to IntegerReverse[n], and False otherwise.

PalindromeQ[string]

returns True if the given string is identical to StringReverse[string], and False otherwise.

Details and Options

Examples

open allclose all

Basic Examples  (3)

A palindromic string:

Check the palindromic property with its list of characters:

A palindromic integer:

This is not palindromic:

Search for palindromic primes:

Scope  (3)

These are English palindromic words:

These are palindromic decimal integers:

These lists remain invariant under reversal:

Generalizations & Extensions  (1)

To find palindromic sentences, remove whitespace and punctuation characters:

Options  (3)

IgnoreCase  (1)

By default, lowercase and uppercase letters are considered different:

Use IgnoreCase->True to treat them as equivalent:

IgnoreDiacritics  (1)

This is a Spanish palindromic word if the diacritic marks are ignored:

Language  (1)

Removal of diacritic marks depends on the choice of language:

Applications  (4)

Tetradic numbers remain invariant when flipped back to front and up-down. Hence they only contain digits 0, 1, 8. These are all tetradic numbers with up to five digits:

Some of them are primes:

It is conjectured that this algorithm eventually produces a palindromic number for every decimal input:

There are numbers for which it is not known whether the algorithm succeeds, the smallest being 196:

Find the palindromic Roman numerals up to 1000:

Find the longest palindromic word in French:

Properties & Relations  (3)

The empty list is considered a palindrome:

The null string is considered a palindrome:

One-digit decimal numbers are considered palindromes:

By default, a string is considered palindromic if its list of characters is palindromic:

The first nine coefficients of this series expansion are special palindromic numbers:

Those coefficients can also be generated as squares of repunits 1, 11, 111, etc.:

Wolfram Research (2015), PalindromeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PalindromeQ.html (updated 2016).

Text

Wolfram Research (2015), PalindromeQ, Wolfram Language function, https://reference.wolfram.com/language/ref/PalindromeQ.html (updated 2016).

CMS

Wolfram Language. 2015. "PalindromeQ." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/PalindromeQ.html.

APA

Wolfram Language. (2015). PalindromeQ. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/PalindromeQ.html

BibTeX

@misc{reference.wolfram_2023_palindromeq, author="Wolfram Research", title="{PalindromeQ}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/PalindromeQ.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_palindromeq, organization={Wolfram Research}, title={PalindromeQ}, year={2016}, url={https://reference.wolfram.com/language/ref/PalindromeQ.html}, note=[Accessed: 19-March-2024 ]}