Skip to main content

Questions tagged [palindrome]

Palindromes are words, phrases, representations of numbers or times which read the same in reverse, for example "level", "reviver", "12321", "10:01". See also the [balanced-string] tag.

Filter by
Sorted by
Tagged with
15 votes
16 answers
1k views

Pretty Palintiples

Imagine you have a positive integer number \$n\$. Let \$m\$ be the number obtained by reversing \$n\$'s digits. If \$m\$ is a whole multiple of \$n\$, then \$n\$ is said to be a reverse divisible ...
Trivaxy's user avatar
  • 487
19 votes
10 answers
3k views

Numbers that can be negated by reading backwards

Balanced ternary is a modified version of ternary (base 3), using the three digits 1,0 and -1...
bsoelch's user avatar
  • 6,035
1 vote
0 answers
164 views

making a binary string palindrome using xor operations [closed]

Problem You are given a binary string A of length N. You can perform the following type of operation on the string A: Choose two different indices \$i\$ and \$j\$ (\$1 \le i\$, \$j \le N\$) Change \$...
hemanth's user avatar
  • 11
19 votes
7 answers
2k views

Farigiraf my Girafarig

A palindrome is a word that is its own reverse. I will define the left palindromic root of a word as the shortest prefix of the word for which the shortest possible palindrome that begins with that ...
FryAmTheEggman's user avatar
33 votes
37 answers
3k views

Is it an alphadrome?

An alphadrome is a word in which each letter in the first half of the word "reflects" its alphabetical "opposite" in the second half of the word. Write a program or function that ...
Jordan's user avatar
  • 10.1k
4 votes
5 answers
280 views

Rotatable numbers (Upside down) [duplicate]

Searching for rotatable numbers, like: 68089 If you consider numbers upside-down, 6 looks like ...
F. Hauri  - Give Up GitHub's user avatar
32 votes
14 answers
5k views

Have you heard of tralindromes?

I haven't. :P So I decided to define one: A tralindrome is a string which contains three equal-length sections X, Y, Z such that all characters in the string are included in at least one of the three ...
Bubbler's user avatar
  • 77k
20 votes
28 answers
3k views

Rearrange to a palindrome

Given a string, shuffle it so that it becomes a palindrome. For example, adadbcc can be arranged into dacbcad, or ...
emanresu A's user avatar
  • 38.8k
5 votes
19 answers
2k views

Palindromic Powers

Powers We define an important power as a number that can be represented as \$ x^y \$ where \$ x ≥ 2 \$ and \$ y ≥ 2 \$. Palindrome We define an ...
Number Basher's user avatar
17 votes
13 answers
1k views

Recursive palindromes

A palindrome is a word which is spelled the same backwards and forwards. For example, "racecar" is a palindrome as is "redder". A double palindrome is a palindrome whose halves are ...
AnttiP's user avatar
  • 7,898
10 votes
5 answers
468 views

The Most Palindromy Code to Calculate Palindromy Numbers

The string abaaba Is a palindrome, meaning it doesn't change when it's reversed. However we can split it in half to make two palindromes ...
Wheat Wizard's user avatar
  • 98.8k
5 votes
1 answer
277 views

Tips on golfing this Python program to generate a palindrome from a string

I wrote this function in 48 bytes and I wonder, is there any way to write this code 2 characters shorter? p=lambda n,c:(n*c)[:n//2]+(n*c)[:n//2+n%2][::-1] The ...
Diana Andrei's user avatar
19 votes
25 answers
3k views

I palindrome the source code, you palindrome the input!

This is a rip-off of a rip-off of a rip-off of a rip-off of a rip-off. Go upvote those! Your task, if you accept it, is to write a program/function that outputs/returns its input/args. The tricky ...
okie's user avatar
  • 1,807
23 votes
27 answers
2k views

Based Palindromes

A palindromic number, as a refresher, is any number which reads the same forward as backwards. However, what about palindromes in other bases? Input Any integer b ...
Gio D's user avatar
  • 504
9 votes
8 answers
371 views

Squarefree Palindromes [closed]

Create the shortest function, program, or expression that calculates a sequence of squarefree palindromic numbers. A squarefree number is one which is not evenly divisible by a square number (i.e. ...
Neel Shukla's user avatar
15 votes
15 answers
3k views

Palindrome distance

Find what is the distance for a given string to its closest palindrome of the same length. For this task I decided to give the characters further away from the string's center more weight (think of it ...
Galen Ivanov's user avatar
20 votes
14 answers
1k views

sporeball numbers

Background We've studied at least five different types of numbers based on the IDs of different users on this site. Why not study another? My user ID is \$91030_{10}\$. Its binary representation is \$...
sporeball's user avatar
  • 1,656
8 votes
4 answers
261 views

Find the index of reflection of a substring of a palindrome [closed]

Problem Statement: You will receive a substring of a palindromic string. You must return the index of the substring which marks the point of reflection of the original string. You are only provided ...
user192361237's user avatar
9 votes
6 answers
605 views

Pairs of palindromic anagramic dates separated by a palindromic number of days

Definitions: A palindrome is a string which reads the same backward or forward (not counting spaces or special characters), such as "madam" or "Sorel Eros". A date is said to be a palindrome when ...
Regis Portalez's user avatar
20 votes
14 answers
1k views

Number of palindrome splits

In this task you will take as input a non-negative integer \$n\$, and output the number of pairs of non-negative integers \$a,b\$ such that both are palindromes*, \$a \leq b\$, and \$a+b = n\$. For ...
Wheat Wizard's user avatar
  • 98.8k
-7 votes
4 answers
294 views

Is this number a palindrome? [closed]

Input A single integer in your language's preferred format, e.g int or an array of digits are all acceptable. Output A truthy or falsely value, depending on ...
Geza Kerecsenyi's user avatar
10 votes
24 answers
2k views

Password Bishop Goodness

Derived from this, now deleted, post. Given a string, answer (truthy/falsy or two consistent values) if it constitutes a good Bishop password, which is when all the following conditions are met: it ...
Adám's user avatar
  • 30.4k
7 votes
1 answer
373 views

A Radiation Hardened Palindromic Quine

There are radiation hardened quines, palindromic quines, but has anyone tried both?! I think not! Rules So the challenge here is to make a quine that if any symbol is deleted it prints its original ...
KrystosTheOverlord's user avatar
17 votes
15 answers
2k views

Is this string a palindrome (in Morse Code)?

Challenge Inspired by this video. As you may know, a palindrome is a word that is spelled the same forward as it is backward. The word "PULP" is not a palindrome, but when translated into ...
Cowabunghole's user avatar
  • 1,650
-2 votes
1 answer
165 views

Every positive integer can be written as the sum of 3 palindrome integers. Wha'ts the largest possible palindrome integer for each integer n? [duplicate]

Let n be a positive integer then n = a + b + c for some a, b, and c that are palindrome integers. What is the largest possible integer ...
xiaodai's user avatar
  • 127
15 votes
12 answers
1k views

Stitch Together a Palindrome from Palindromic Substrings

Given a string l, find all palindromic substrings p of l (including duplicates and single ...
Magic Octopus Urn's user avatar
5 votes
9 answers
565 views

Length of the Longest Palindromic Substring [duplicate]

A palindrome is a string which is the same when read forwards and backwards. For example "racecar" is a palindrome, but "Racecar" is not. A substring is a contiguous set of characters in a larger ...
Bijan's user avatar
  • 841
11 votes
13 answers
2k views

List all palindromic prime dates between 0000-01-01 and 99999-12-31

You know what a palindrome, a prime and a date are. Your task is to list all dates in 100 thousands of years that fulfill all three characteristics. Nevermind anything but the numbers, use the ...
Peter Wirdemo's user avatar
49 votes
24 answers
5k views

Downgrade to a Palindrome

Given a string s, return the smallest contiguous substring you can remove to create a palindrome. Examples: ...
Magic Octopus Urn's user avatar
72 votes
26 answers
9k views

Yo boy, must it sum

Every positive integer can be expressed as the sum of at most three palindromic positive integers in any base b≥5.   Cilleruelo et al., 2017 A positive integer is palindromic in a given base if ...
Luis Mendo's user avatar
  • 105k
5 votes
7 answers
793 views

Smaller-Base Palindromes

For the purpose of this challenge, a smaller-base palindrome (SBP) is a number which is palindromic in a base between 1 and itself (exclusive), and is not a repdigit in the same base. For example, 5 ...
Gryphon's user avatar
  • 7,235
8 votes
14 answers
562 views

Count the Palindromes [duplicate]

Given a number n, calculate the amount of bases in the range of [2, n) in which b(n) is a ...
ATaco's user avatar
  • 10.8k
30 votes
25 answers
3k views

Palindromic numbers with a binary twist

Warning : this is NOT a "hey, let's draw a cake in ASCII-art" challenge! Please keep reading ;) Some time ago it was my birthday, I'm 33 now. So there is this awkward social tradition consisting in ...
Goufalite's user avatar
  • 401
4 votes
1 answer
279 views

Find the Closest Double Palindrome

Given a double-precision float, find the closest double-precision float whose binary representation is a palindrome. Input A floating point number x. You may use ...
AJMansfield's user avatar
  • 2,898
7 votes
16 answers
1k views

Emoticon numbers!

(related) Your challenge is to output the highest number you can. You can output as a number or as a string. You must output something that matches the regex ^\d+$,...
user avatar
20 votes
15 answers
2k views

Fully-palindromic triangles

Consider the string 160615051. It can be "triangulated" as such: 1 606 15051 Then, each row is a palindrome. Also note ...
Conor O'Brien's user avatar
66 votes
47 answers
5k views

User Appreciation Challenge #1: Dennis ♦

I got the spontaneous idea of making a series of challenges of users that have helped and continue to help the PPCG community be an enjoyable place for everyone, or maybe just specifically for me. :P ...
hyper-neutrino's user avatar
  • 42.4k
25 votes
11 answers
6k views

Perfect Palindromes

Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1. To determine the perfectness of a string, you ...
Okx's user avatar
  • 16.4k
15 votes
10 answers
2k views

Palindromic Primes without 11

Every palindrome with an even number of digits is divisible by 11, so 11 is the only [palindromic prime] with an even number of digits. - David Wasserman, OEIS I learned this today the manual way, ...
Stephen's user avatar
  • 14k
15 votes
16 answers
4k views

Never odd or even

Did you notice, that this is a palindrome? Input Non-negative integer number or string representing it Output 4 possible outputs, representing two properties of number: is it palindrome tricky #2 ...
Dead Possum's user avatar
  • 3,434
27 votes
14 answers
1k views

Palindromic Residue

Today, as I'm writing this, is March 31st. In the US, this is 3/31. I was playing around with 331 as a number to come up with a ...
AdmBorkBork's user avatar
  • 43.4k
10 votes
6 answers
520 views

Numbers that are palindromes in N bases

Given an non-negative integer \$n \ge 0\$, output forever the sequence of integers \$x_i \ge 3\$ that are palindromes in exactly \$n\$ different bases \$b\$, where the base can be \$2 \le b le x_i-2\$....
mbomb007's user avatar
  • 23.4k
12 votes
16 answers
1k views

Number of string permutations that are palindromes

Your input will be a string consisting of small english letters. Your task is to determine the number of distinct permutations of the original string that are a palindrome. The input string has up ...
Andrei Mihailescu's user avatar
118 votes
76 answers
28k views

I'm a palindrome. Are you?

There have been a couple of previous attempts to ask this question, but neither conforms to modern standards on this site. Per discussion on Meta, I'm reposting it in a way that allows for fair ...
user avatar
1 vote
0 answers
72 views

Complete my palindrome [duplicate]

Create a function (preferably) or a program that takes an ordered collection and outputs the smallest possible palindrome that starts with the input. For example: ...
minseong's user avatar
  • 1,289
10 votes
10 answers
484 views

Smallest Multiple to "Palindromize" [duplicate]

Goal: Given any non-zero natural number a, find the smallest non-zero natural number b such that ...
Julian Lachniet's user avatar
4 votes
4 answers
649 views

The Essential™ (comment-free) Convenient Palindromic Quine Golf

A program is "conveniently palindromic" if it is equal to the string derived when its reverse has all its parentheses (()), brackets (...
noɥʇʎԀʎzɐɹƆ's user avatar
42 votes
33 answers
3k views

Goodness Giza Golf!

A "Giza number", also colloquially known as a Timmy Number is any number where the digits represent a pyramid (A134810). For example, "12321" is a giza number because it can be visualized like this: <...
DJMcMayhem's user avatar
  • 59.3k
15 votes
15 answers
2k views

Palindrome polyglot

Your task is to write a program that runs in two different languages, and does the following: In one language, it palindromizes a given string. Take the string. ...
Oliver Ni's user avatar
  • 10.6k
15 votes
7 answers
1k views

Minimum insertions to make palindrome

Today you will be doing another palindrome challenge! So, your task today is to take a string, and determine the minimum amount of letters required to insert to turn it into a palindrome. For ...
Oliver Ni's user avatar
  • 10.6k