• Welcome to OGBoards 10.0, keep in mind that we will be making LOTS of changes to smooth out the experience here and make it as close as possible functionally to the old software, but feel free to drop suggestions or requests in the Tech Support subforum!

Palindrome Post Party!

4444-done-on-Cinema-4D-1041428.jpg
 
can't find a picture of 12221 so here's one of adam scott.

df45067ed0195a0ce63fd002be0e7bdd.jpg
 
141


c141_05.jpg


The Air Force workhorse transport plane.
 
Last edited:
Math: do palindrome posts become more rare as you increase your count?

I would think so. In the hundreds, every 10th post is a palindrome. In the thousands it's every 110 posts. In the ten thousands it's every 100 posts or so. In the hundred thousands is where it would really be an occasion - every 1100 posts or so I think.

Is there a mathematical way to prove this out?
 
Math: do palindrome posts become more rare as you increase your count?

I would think so. In the hundreds, every 10th post is a palindrome. In the thousands it's every 110 posts. In the ten thousands it's every 100 posts or so. In the hundred thousands is where it would really be an occasion - every 1100 posts or so I think.

Is there a mathematical way to prove this out?

import java.io.PrintWriter;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Random;

public class PalindromicPrimeFinder implements Runnable {

/**
* Test main
*/
public static void main(String[] args) {

int maxDepth = 50;
int testCertainty = 20;
Character[] digitsFinal = { '1', '7' }; // should be a subset of {1, 3, 7, 9}
Character[] digitsAll = { '1', '7' };
PrintWriter writer = new PrintWriter(System.out);

PalindromicPrimeFinder finder = new PalindromicPrimeFinder(
maxDepth, testCertainty, digitsFinal, digitsAll, writer);

finder.run();

}


private final Random random = new Random();

private final int maxDepth;
private final int testCertainty;
private final Character[] digitsFinal;
private final Character[] digitsAll;
private final PrintWriter writer;


/**
* Constructor.
*
* @param start The starting number
* @param maxDepth Max search depth
* @param testCertainty Certainty of primality test
* @param digitsFinal final digits (subset of {1, 3, 7, 9})
* @param digitsAll all digits
*/
public PalindromicPrimeFinder(int maxDepth,
int testCertainty, Character[] digitsFinal, Character[] digitsAll,
PrintWriter writer) {
this.maxDepth = maxDepth;
this.testCertainty = testCertainty;
this.digitsFinal = digitsFinal;
this.digitsAll = digitsAll;
this.writer = writer;
}


/**
* Run method
*/
@Override
public void run() {
String start = ""+digitsFinal[random.nextInt(digitsFinal.length)];
findPalindromicPrime(start, 0);
}

/**
* Worker recursive method
* @param number current number
* @param depth current depth
*/
private void findPalindromicPrime(String number, int depth) {

for (char digit : digitsFinal) {
String nextNumber = digit + number + digit;
if (new BigInteger(nextNumber).isProbablePrime(testCertainty)) {
writer.println("New prime [length=" + nextNumber.length()
+ "]: " + nextNumber + "\n");
writer.flush();
findPalindromicPrime(nextNumber, 0);
return;
}
}

if (depth > maxDepth) {
return;
}

List<Character> digitsAll_shuffled = new ArrayList<Character>(
Arrays.asList(digitsAll));
Collections.shuffle(digitsAll_shuffled, random);
for (char digit : digitsAll_shuffled) {
String nextNumber = digit + number + digit;
findPalindromicPrime(nextNumber, depth + 1);
}

}

}
 
the first of those is a java hack that can generate a 1000 digit palindrome made of only prime numbers

the second is a proof that all even number of digits palindromes are divisible by 11.
 
Back
Top