login
This site is supported by donations to The OEIS Foundation.

 

Logo


Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A007633 Palindromic in bases 3 and 10.
(Formerly M1164)
40
0, 1, 2, 4, 8, 121, 151, 212, 242, 484, 656, 757, 29092, 48884, 74647, 75457, 76267, 92929, 93739, 848848, 1521251, 2985892, 4022204, 4219124, 4251524, 4287824, 5737375, 7875787, 7949497, 27711772, 83155138, 112969211, 123464321 (list; graph; refs; listen; history; text; internal format)
OFFSET

1,3

REFERENCES

J. Meeus, Multibasic palindromes, J. Rec. Math., 18 (No. 3, 1985-1986), 168-173.

N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

LINKS

Robert Israel and Robert G. Wilson v, Table of n, a(n) for n = 1..65 (first 41 terms from Robert Israel)

MAPLE

ND:= 12;  # to get all terms with <= ND decimal digits

rev10:= proc(n) option remember;

  rev10(floor(n/10)) + (n mod 10)*10^ilog10(n)

end;

for i from 0 to 9 do rev10(i):= i od:

rev3:= proc(n) option remember;

  rev3(floor(n/3)) + (n mod 3)*3^ilog[3](n)

end;

for i from 0 to 2 do rev3(i):= i od:

pali3:= n -> rev3(n) = n;

count:= 1:

A[1]:= 0:

for d from 1 to ND do

  d1:= ceil(d/2);

  for x from 10^(d1-1) to 10^d1 - 1 do

    if d::even then y:= x*10^d1+rev10(x)

    else y:= x*10^(d1-1)+rev10(floor(x/10));

    fi;

    if pali3(y) then

       count:= count+1;

       A[count]:= y;

    fi

  od:

od:

seq(A[i], i=1..count); # Robert Israel, Apr 20 2014

MATHEMATICA

Do[ a = IntegerDigits[n]; b = IntegerDigits[n, 3]; If[a == Reverse[a] && b == Reverse[b], Print[n] ], {n, 0, 10^9} ]

NextPalindrome[n_] := Block[{l = Floor[ Log[10, n] + 1], idn = IntegerDigits[n]}, If[ Union[idn] == {9}, Return[n + 2], If[l < 2, Return[n + 1], If[ FromDigits[ Reverse[ Take[idn, Ceiling[l/2]] ]] FromDigits[ Take[idn, -Ceiling[l/2]]], FromDigits[ Join[ Take[idn, Ceiling[l/2]], Reverse[ Take[idn, Floor[l/2]] ]]], idfhn = FromDigits[ Take[idn, Ceiling[l/2]]] + 1; idp = FromDigits[ Join[ IntegerDigits[idfhn], Drop[ Reverse[ IntegerDigits[idfhn]], Mod[l, 2]] ]]] ]]]; palQ[n_Integer, base_Integer] := Block[{idn = IntegerDigits[n, base]}, idn == Reverse[idn]]; l = {0}; a = 0; Do[a = NextPalindrome[a]; If[ palQ[a, 4], AppendTo[l, a]], {n, 100000}]; l (* Robert G. Wilson v, Sep 30 2004 *)

PROG

(Python)

from itertools import chain

from gmpy2 import digits

A007633_list = sorted([n for n in chain((int(str(x)+str(x)[::-1]) for x in range(1, 10**6)), (int(str(x)+str(x)[-2::-1]) for x in range(10**6))) if digits(n, 3) == digits(n, 3)[::-1]]) # Chai Wah Wu, Nov 23 2014

CROSSREFS

Cf. A007632, A029961, A029962, A029963, A029964, A029804, A029965, A029966, A029967, A029968, A029969, A029970, A029731, A097855, A099165.

Sequence in context: A018694 A129661 A018713 * A018777 A130693 A060815

Adjacent sequences:  A007630 A007631 A007632 * A007634 A007635 A007636

KEYWORD

nonn,base

AUTHOR

N. J. A. Sloane, Mira Bernstein, Robert G. Wilson v

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recent | More pages
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy .

Last modified March 27 04:08 EDT 2017. Contains 284144 sequences.