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.

A196510 Smallest number greater than n that is palindromic in base 3 and base n.

This page as a plain text file.
%I A196510 #30 Jan 16 2022 15:46:22
%S A196510 6643,4,10,26,28,8,121,10,121,244,13,28,1210,16,68,784,1733,20,1604,
%T A196510 242,23,2096,100,26,937,28,203,3280,1952,160,1249,68,280,1366,14483,
%U A196510 608,11293,40,82,5948,7102,484,2069,644,1222,4372,784,100,6452,52
%N A196510 Smallest number greater than n that is palindromic in base 3 and base n.
%H A196510 Zak Seidov, <a href="/A196510/b196510.txt">Table of n, a(n) for n = 2..1000</a>
%H A196510 Erich Friedman, <a href="https://erich-friedman.github.io/mathmagic/0699.html">Problem of the month June 1999</a>
%p A196510 ispal := proc(n,b)
%p A196510         dgs := convert(n,base,b) ;
%p A196510         for i from 1 to nops(dgs)/2 do
%p A196510                 if op(i,dgs) <> op(-i,dgs) then
%p A196510                         return false;
%p A196510                 end if;
%p A196510         end do;
%p A196510         return true;
%p A196510 end proc:
%p A196510 A196510 := proc(n)
%p A196510         for k from n+1 do
%p A196510                 if ispal(k,n) and ispal(k,3) then
%p A196510                         return k;
%p A196510                 end if;
%p A196510         end do:
%p A196510 end proc:
%p A196510 seq(A196510(n),n=2..30) ; # _R. J. Mathar_, Oct 13 2011
%t A196510 pal3n[n_]:=Module[{k=n+1},While[IntegerDigits[k,3]!=Reverse[ IntegerDigits[ k,3]] || IntegerDigits[ k,n]!= Reverse[ IntegerDigits[k,n]],k++];k]; Array[ pal3n,60,2] (* _Harvey P. Dale_, Jan 16 2022 *)
%o A196510 (Sage)
%o A196510 def A196510(n):
%o A196510     is_palindrome = lambda x,b=10: x.digits(b) == (x.digits(b))[::-1]
%o A196510     return next(k for k in IntegerRange(n+1, infinity) if is_palindrome(k,n) and is_palindrome(k,3))
%o A196510 # _D. S. McNeil_, Oct 03 2011
%Y A196510 Cf. A056749.
%K A196510 nonn,base
%O A196510 2,1
%A A196510 _Kausthub Gudipati_, Oct 03 2011