A100563 Number of bases less than sqrt(n) in which n is a palindrome.
0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 1, 1, 2, 0, 0, 1, 2, 0, 1, 0, 1, 2, 1, 1, 1, 0, 2, 0, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 2, 0, 0, 1, 1, 2, 2, 0, 0, 2, 1, 2, 0, 1, 0, 1, 1, 2, 1, 3, 0, 2, 1, 0, 0, 1, 1, 2, 1, 0, 0, 0, 2, 0, 2, 1, 2, 1, 0, 3, 1, 0, 1, 1, 0, 2, 2, 2, 0, 0, 0, 1, 2, 1, 3, 1, 0, 0, 2, 2
Offset: 1
Examples
100 is a palindrome in bases 3, 7 and 9, so a(100) = 3.
Links
- Robert G. Wilson v, Table of n, a(n) for n = 1..1000
- Wikipedia, Base 1
Crossrefs
Programs
-
Mathematica
f[n_] := Module[{p}, Table[ p = IntegerDigits[n, b]; If[p == Reverse@ p, {b, p}, Sequence @@ {}], {b, 2, Sqrt@ n}]]; Array[ Length@ f@# &, 105] (* Robert G. Wilson v, Nov 01 2014 *)
-
PARI
a(n) = {my(nb = 0); for (b=2, sqrt(n), d = digits(n, b); nb+= (Vecrev(d) == d);); nb;} \\ Michel Marcus, Nov 05 2014
Formula
Extensions
a(58) from Robert G. Wilson v, Nov 05 2014
Comments