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.


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:


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.


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


  • 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.
  • \$\begingroup\$ Aren't single digit numbers palindromic? They read the same backwards and forwards. \$\endgroup\$ Jun 1, 2015 at 16:27
  • \$\begingroup\$ @RetoKoradi Correct. That's why we only consider bases less than n-1, so there will always be at least two digits. \$\endgroup\$
    – Ypnypn
    Jun 1, 2015 at 16:28

1 Answer 1


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

Here is the board:


This contains the following programs:

CJam (27 bytes)


Test it here.

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

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

GolfScript (34 bytes)


Test it here.

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.