Non-Palindromic Polyglot Boggle

11

1

Introduction

The number 101 is a palindrome, since it reads the same backwards and forwards. The number 105 is not. However, 105 in base eight is written as 151, which is palindromic. On the other hand, 103 is not a palindrome in any base from 2 to 101. Hence, 103 is strictly non-palindromic.

The precise definition is: A nonnegative integer n is strictly non-palindromic if it is not a palindrome in any base between 2 and n-2, inclusive.

The first few strictly non-palindromic numbers are 0, 1, 2, 3, 4, 6, 11, 19, 47, 53, 79, 103, 137, 139, 149, 163, 167, 179, 223, 263, 269... (A016038)

Write a full program that takes a number x from STDIN and prints the xth strictly non-palindromic number. For example, the input 5 would produce the output 4.

Challenge

The challenge is to write multiple (one or more) programs, each solving this task in a different language.

Then, you must put all of the programs in a rectangular grid of characters. The programs can be accessed Boggle-style. That is, go from one character to a neighboring character (including diagonally), never using the same character more than once.

For example, the following grid:

abc
bdc

includes the words abc, ccd, bbad, and bcdb, but not ac, bdd, bcb, or cbbc.

Each program must be found in the grid using these rules. However, you may use the same character in multiple programs.

Score

Your score is the number of characters in the grid, divided by the number of programs. Lowest score wins!

Rules

  • Two languages are considered different if they usually go by different names, ignoring version numbers. For example, C and C++ are different, but Python 2 and Python 3 are the same.
  • The characters in the grid must all be from printable ASCII, i.e., from to ~, code points 20 through FE.
  • Each program must consist only of printable ASCII, plus newlines. When inserting a program into the grid, replace each newline with a space.
    • A space in the grid may represent a space in one program and a newline in another.
  • The grid must be a rectangle.
  • Not every character needs to be used in a program.

Ypnypn

Posted 2015-06-01T13:48:43.430

Reputation: 10 485

Aren't single digit numbers palindromic? They read the same backwards and forwards. – Reto Koradi – 2015-06-01T16:27:56.283

@RetoKoradi Correct. That's why we only consider bases less than n-1, so there will always be at least two digits. – Ypnypn – 2015-06-01T16:28:47.660

Answers

10

19x2 = 38, 2 programs, Score: 26 19.5 19

Here is the board:

-:\~{.,><1\b_W%}}g}
1Wq{)_2W{$ase.=,do*

This contains the following programs:

CJam (27 bytes)

Wq~{{)_,2>W<{1$\b_W%=},}g}*

Test it here.

These are the characters of the board used for this code:

   ~{ ,><1\b_W%}}g}
 Wq{)_2W{$    =,  *

GolfScript (34 bytes)

-1:W\~{{).,2>W<{1$\base.W%=},}do}*

Test it here.

These are the characters of the board used for this code:

-:\~{.,><1\b W%}} }
1W {) 2W{$ase.=,do*

Martin Ender

Posted 2015-06-01T13:48:43.430

Reputation: 184 808