A006072 Numbers with mirror symmetry about middle.
0, 1, 8, 11, 88, 101, 111, 181, 808, 818, 888, 1001, 1111, 1881, 8008, 8118, 8888, 10001, 10101, 10801, 11011, 11111, 11811, 18081, 18181, 18881, 80008, 80108, 80808, 81018, 81118, 81818, 88088, 88188, 88888, 100001, 101101, 108801, 110011, 111111, 118811, 180081
Offset: 1
References
- N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
Links
- Michael S. Branicky, Table of n, a(n) for n = 1..10000 (terms 1..1450 from Vincenzo Librandi)
- Eric Weisstein's World of Mathematics, Tetradic Number
Programs
-
Mathematica
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]]]]]]]]; np = 0; t = {0}; Do[np = NextPalindrome[np]; If[Union[Join[{0, 1, 8}, IntegerDigits[np]]] == {0, 1, 8}, AppendTo[t, np]], {n, 1150}]; t (* Robert G. Wilson v *) TetrNumsUpTo10powerK[k_]:= Select[FromDigits/@ Tuples[{0, 1, 8}, k],IntegerDigits[#] == Reverse[IntegerDigits[#]] &]; TetrNumsUpTo10powerK[7] (* Mikk Heidemaa, May 21 2017 *)
-
PARI
{for(l=1,5,u=vector((l+1)\2,i,10^(i-1)+(2*i-1
1&&i==1,2]), print1((v+v\2*6)*u", ")))} \\ The n-th term could be produced by using (partial sums of) A225367 to skip all shorter terms, and then skipping the adequate number of vectors v until n is reached. - M. F. Hasler, May 05 2013 -
Python
from itertools import count, islice, product def agen(): yield from [0, 1, 8] for d in count(2): for start in "18": for rest in product("018", repeat=d//2-1): left = start + "".join(rest) for mid in [[""], ["0", "1", "8"]][d%2]: yield int(left + mid + left[::-1]) print(list(islice(agen(), 42))) # Michael S. Branicky, Mar 29 2022
Formula
Extensions
More terms from Robert G. Wilson v, Nov 16 2005
Comments