17
votes
5answers
852 views

Count distinct primes, discarding palindromes, in under 2 seconds

Problem Statement Generate as many distinct primes P such that reverse (P) is also prime and is not equal to P. Output: Print per line one integer( ≤ 1015 ). Don't print more than ...
7
votes
2answers
136 views

Lychrel calculator (Project Euler 55)

If we take 47, reverse and add, 47 + 74 = 121, which is palindromic. Not all numbers produce palindromes so quickly. For example, ...
3
votes
1answer
110 views

Minimum number of letters removed, to make a string Peragram

Here is the link to the problem Peragrams. Peragrams: If a word is an anagram of at least one palindrome, we call it a Peragram. Problem: Given a string, find the minimum number of letters ...
3
votes
1answer
1k views

Create palindrome by rearranging letters of a word

Inspired by a recent question that caught my interest (now deleted), I wrote a function in Python 3 to rearrange the letters of a given string to create a (any!) palindrome: Count the occurrences of ...
2
votes
2answers
357 views

Project Euler, #4: Incorrect Results on 7-digit numbers

I've got my answer working (up until a 7-digit answer is requested, anyway), and would like some help returning the correct answer speeding up the results I was thinking of storing the values of ...
2
votes
1answer
188 views

Python Palindrome Generator

I've just written a palindrome generator and would like to know what you think about it. Especially: code style Is it possible to get the same result without making a special case for 1-digit ...
1
vote
3answers
81 views

Optimizing Project Euler 36 - double-base palindromes

This one was quick and simple. Any optimizations? ...
1
vote
6answers
1k views

The Next Palindrome - reducing total execution time

I tried to solve one SPOJ problem. I wrote one program in Python, however, it got accepted by the SPOJ judges, but its total execution time is 2.88s. The same algorithm used in C language having ...
1
vote
4answers
5k views

Simple palindrome function for single words

I have created a simple palindrome function that works only on single words. It is working as intended, but I feel that it definitely needs improvement. ...
1
vote
1answer
472 views

Reverse and Add: find a palindrome

This is one of codeeval challenges Challenge Description: Credits: Programming Challenges by Steven S. Skiena and Miguel A. Revilla The problem is as follows: choose a number, reverse ...