Project Euler/4

From Esolang
Jump to navigation Jump to search

Back to User:ProjectEuler

Project Euler Problem 4 is a problem related to palindromic numbers. The goal is to find out the largest palindromic number (in base 10) that is the product of two 3-digit numbers.

This article is not detailed enough and needs to be expanded. Please help us by adding some more information.

Implementations

Aheui

This program uses a palindrome detector that would theoretically work for all positive whole numbers below 1 billion[citation needed]. The palindrome detector also contains a code snippet for integer logarithm (designed for determining how many digits there are in a number). This program costs approximately half an hour to run at full speed on AheuiChem. It may still need reduction.

바싿밟밣밝반따따따밟타빠싹빠삭빠싸사따빠바쌀뿌서더너벌벌
삭다사박발따나살발발나타뿌소쎡버너벗뻐설뻐머차박발따나솔
쏙뚜번벌석러떠번벌뻐서야쳐오마빠박루쀼서뻐섣차사마빠삭뿌
소떠삭발발나타발ㅇㅇㅇ초저박뱔셔땨쳐나사싹삭토초어쏟수써
아아초삭무밝북따붍싹샥샫오망희ㅇㅇㅇ싿삳자아야먀오소타아
발냐별토밟봃따또탸뽀뺘셛샤뗘뺘셕썩

Rockstar

Rhythm is bam-bam-bam.
A feather is up.
The party is perfection.

Music wants emotion.
If emotion is as weak as a feather,
give back silence.

Put rhythm in life.
While life is lower than emotion without rhythm.
Rock the world with emotion at life.
Build life up.

Join the world.
Give the world back.

Healing takes time.
Shatter time.
If time is smaller than a feather
give right back
else
let first be time at the party.
Let last be time without rhythm.
Let last be time at last.
Send first is last and healing taking music taking time.

This is for you, mom.
You are you.
Let this be of you.
Let just be this.
Glass is shattering
until gone.
Let the story be just of this
if the story is as weak as glass.
Break it down.

While the story is greater than glass
if healing taking the story,
let glass be the story.
Break it down.

Knock just down.
Let the story be just of this.

Knock this down.
Let just be this.

Say glass.

Python

# Euler Problem 4
# by Europe2048

def isPalindrome(s):
    return s == s[::-1]

maxnum = 0

for i in range(10000, 998001):
    if isPalindrome(i) == False:
        i += 1
        continue
    
    prev_primes = []
    factors = []
    
    for n in range(100, 999):
        if (test / n) % 1 == 0:
            factors.append(n)
    
    if factors != []:
        if i > maxnum:
            maxnum = i
        i += 1
        continue

External resources

  • A308803 and A327897, two related sequences on the OEIS. "308803" is a palindrome as well.
  • Problem 4 on Project Euler Official Website (not available)
  • Problem 4 on Project Euler Mirror