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.

A111156 Numbers that look the same when printed upside down.

This page as a plain text file.
%I A111156 #16 Apr 30 2024 14:49:24
%S A111156 0,8,69,88,96,609,689,808,888,906,986,6009,6699,6889,6969,8008,8698,
%T A111156 8888,8968,9006,9696,9886,9966,60009,60809,66099,66899,68089,68889,
%U A111156 69069,69869,80008,80808,86098,86898,88088,88888,89068,89868,90006,90806,96096,96896,98086,98886,99066,99866,600009
%N A111156 Numbers that look the same when printed upside down.
%C A111156 Numbers with 1's are excluded.
%C A111156 Numbers written with digits 0,6,8,9, with 6 and 9 interchanged when reversed. - _Robert Israel_, Jul 02 2018
%H A111156 Robert Israel, <a href="/A111156/b111156.txt">Table of n, a(n) for n = 1..10000</a>
%p A111156 f:= proc(n) local L,Lp,nl;
%p A111156    L:= subs(1=6,2=8,3=9,convert(n,base,4));
%p A111156    nl:= nops(L);
%p A111156    Lp:= subs([6=9,9=6],L);
%p A111156    add(Lp[-i]*10^(i-1),i=1..nl)+add(L[i]*10^(nl+i-1),i=1..nl);
%p A111156 end proc:
%p A111156 g:= proc(n) local L,Lp,nl;
%p A111156    L:= subs(1=6,2=8,3=9,convert(n,base,4));
%p A111156    nl:= nops(L);
%p A111156    Lp:= subs([6=9,9=6],L);
%p A111156    seq(add(Lp[-i]*10^(i-1),i=1..nl)+x*10^nl+add(L[i]*10^(nl+i),i=1..nl),x=[0,8]);
%p A111156 end proc:
%p A111156 0,8,seq(op([seq(f(n),n=4^i..4^(i+1)-1),seq(g(n),n=4^i..4^(i+1)-1)]),i=0..2); # _Robert Israel_, Jul 02 2018
%t A111156 Select[Range[0,600010],ContainsOnly[IntegerDigits[#],{0,6,8,9}]&&IntegerReverse[FromDigits[IntegerDigits[#]/.{6->9,9->6}]]==#&] (* _James C. McMahon_, Apr 30 2024 *)
%o A111156 (Haskell) main=print$"0":concat[concat[[reverse(reverse(map f x)++z++x)|x<-y]|z<-["","0"]]|y<-s(iterate i"6")];f '0'='0';f '6'='9';f '8'='8';f '9'='6';i('0':x)='6':x;i('6':x)='8':x;i('8':x)='9':x;i('9':x)='0':i x;i""="6";s(x:y@(z:_))=let w:v=s y in if length x==length z then(x:w):v else[x]:w:v
%o A111156 (Python)
%o A111156 from itertools import count, islice, product
%o A111156 def ud(s): return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')})
%o A111156 def agen():
%o A111156     yield from [0, 8]
%o A111156     for d in count(2):
%o A111156         for start in "689":
%o A111156             for rest in product("0689", repeat=d//2-1):
%o A111156                 left = start + "".join(rest)
%o A111156                 right = ud(left)
%o A111156                 for mid in [[""], ["0", "8"]][d%2]:
%o A111156                     yield int(left + mid + right)
%o A111156 print(list(islice(agen(), 48))) # _Michael S. Branicky_, Mar 29 2022
%Y A111156 Cf. strobogrammatic numbers A000787. If 8's are excluded we get A111065.
%K A111156 base,easy,nonn
%O A111156 1,2
%A A111156 Paul Stoeber (pstoeber(AT)uni-potsdam.de), Oct 09 2005
%E A111156 Corrected by _Robert Israel_, Jul 02 2018