cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A253594 Numbers n that have more than one palindromic representation in bases 2 <= b <= n-2.

This page as a plain text file.
%I A253594 #16 Aug 20 2025 15:11:28
%S A253594 10,15,16,17,18,20,21,24,26,27,28,30,31,32,33,34,36,38,40,42,44,45,46,
%T A253594 48,50,51,52,54,55,56,57,60,62,63,64,65,66,67,68,70,72,73,74,75,76,78,
%U A253594 80,81,82,84,85,86,88,90,91,92,93,96,98,99,100,102,104,105,107,108,109,110,111,112,114,116,117,118,119,120,121,122,123,124
%N A253594 Numbers n that have more than one palindromic representation in bases 2 <= b <= n-2.
%C A253594 We do not include base n-1, because every n>2 is written '11' in base n-1.
%H A253594 Michael S. Branicky, <a href="/A253594/b253594.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1685 from Christian Perfect)
%e A253594 10 is written '101' in base 3, and '22' in base 4.
%e A253594 12 is written '22' in base 5, but is not a palindrome in any other base up to 10, so does not belong to this sequence.
%t A253594 palbQ[b_,n_]:=With[{idb=IntegerDigits[n,b]},idb==Reverse[idb]]; Select[Range[150],Total[Boole[Table[palbQ[b,#],{b,2,#-2}]]]>1&] (* _Harvey P. Dale_, Aug 20 2025 *)
%o A253594 (Python)
%o A253594 from itertools import count
%o A253594 def base(n,b):
%o A253594    while n:
%o A253594       m = n%b
%o A253594       yield m
%o A253594       n = (n-m)//b
%o A253594 def is_palindrome(seq):
%o A253594    seq = list(seq)
%o A253594    l = len(seq)//2
%o A253594    return seq[:l] == seq[-1:-l-1:-1]
%o A253594 def a():
%o A253594    for n in count(2):
%o A253594       base_representations = [(b,list(base(n,b))) for b in range(2,n-1)]
%o A253594       pals = [(b,s) for b,s in base_representations if is_palindrome(s)]
%o A253594       if len(pals)>1:
%o A253594          yield n
%o A253594 (Python)
%o A253594 from sympy.ntheory import digits
%o A253594 def ok(n):
%o A253594     c = 0
%o A253594     for b in range(2, n-1):
%o A253594         d = digits(n, b)[1:]
%o A253594         c += int(d == d[::-1])
%o A253594         if c == 2: return True
%o A253594     return c > 1
%o A253594 print([k for k in range(125) if ok(k)]) # _Michael S. Branicky_, Feb 05 2024
%K A253594 nonn,base,easy
%O A253594 1,1
%A A253594 _Christian Perfect_, Jan 05 2015