A018848 Strobogrammatic squares: the same upside down (probably finite).
0, 1, 6889, 69169, 109181601
Offset: 1
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.
from itertools import count, islice, product def ud(s): return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')}) def agen(): yield from [0, 1] for d in count(2): for start in "169": for rest in product("0169", repeat=d//2-1): left = start + "".join(rest) right = ud(left) for mid in [[""], ["0", "1"]][d%2]: yield int(left + mid + right) print(list(islice(agen(), 43))) # Michael S. Branicky, Mar 29 2022
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
f:= proc(n) local L,Lp,nl; L:= subs(1=6,2=8,3=9,convert(n,base,4)); nl:= nops(L); Lp:= subs([6=9,9=6],L); add(Lp[-i]*10^(i-1),i=1..nl)+add(L[i]*10^(nl+i-1),i=1..nl); end proc: g:= proc(n) local L,Lp,nl; L:= subs(1=6,2=8,3=9,convert(n,base,4)); nl:= nops(L); Lp:= subs([6=9,9=6],L); 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]); end proc: 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
Select[Range[0,600010],ContainsOnly[IntegerDigits[#],{0,6,8,9}]&&IntegerReverse[FromDigits[IntegerDigits[#]/.{6->9,9->6}]]==#&] (* James C. McMahon, Apr 30 2024 *)
from itertools import count, islice, product def ud(s): return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')}) def agen(): yield from [0, 8] for d in count(2): for start in "689": for rest in product("0689", repeat=d//2-1): left = start + "".join(rest) right = ud(left) for mid in [[""], ["0", "8"]][d%2]: yield int(left + mid + right) print(list(islice(agen(), 48))) # Michael S. Branicky, Mar 29 2022
19606 = 2 * 9803 upside-down is 90961 = 13 * 6997.
UpsideDown := proc(n) local dgs,a,i ; dgs := convert(n,base,10) ; a := [] ; for i from 1 to nops(dgs) do if op(i,dgs) = 6 then a := [9,op(a)] ; elif op(i,dgs) = 9 then a := [6,op(a)] ; else a := [op(i,dgs),op(a)] ; fi; od: add(op(i,a)*10^(i-1),i=1..nops(a)) ; end: isA054047 := proc(n) local dgs,i ; dgs := convert(n,base,10) ; for i from 1 to nops(dgs) do if not op(i,dgs) in {0,1,6,8,9} then RETURN(false) : fi; od: RETURN(true) ; end: isA001358 := proc(n) if numtheory[bigomega](n) = 2 then true; else false; fi; end: isA119738 := proc(n) if isA001358(n) and isA054047(n) then isA001358(UpsideDown(n)) ; else false ; fi; end: for n from 1 to 12000 do if isA119738(n) then printf("%a,",n) ; fi; od: # R. J. Mathar, Sep 09 2008
Select[Range[8611],ContainsOnly[IntegerDigits[#],{0,1,6,8,9}]&&PrimeOmega[#]==2&&PrimeOmega[FromDigits[Reverse[IntegerDigits[#]]/.{6->9,9->6}]]==2&] (* James C. McMahon, Sep 18 2024 *)
\\ See Corneth link. David A. Corneth, Sep 05 2020
A[2,4] = 5 because 4th strobogrammatic number base 2 = 101 = 5 (base 10). A[9,8] = 154 because 8th strobogrammatic number base 9 = 181 = 154 (base 10). The array begins: =================================================================================== ..n.|.1.|.2.|.3.|..4.|..5.|...6.|...7.|....8.|....9.|...10.|...11.|....12.| =================================================================================== k=1.|.0.|.1.|.2.|..3.|..4.|...5.|...6.|....7.|....8.|....9.|...10.|....11.| k=2.|.0.|.1.|.3.|..5.|..7.|...9.|..15.|...17.|...21.|...27.|...31.|....33.|A006995 k=3.|.0.|.1.|.4.|.10.|.13.|..28.|..40.|...82.|...91.|..112.|..121.|...244.| k=4.|.0.|.1.|.5.|.17.|.21.|..65.|..85.|..257.|..273.|..325.|..341.|..1025.| k=5.|.0.|.1.|.6.|.26.|.31.|.126.|.156.|..626.|..651.|..756.|..781.|..3126.| k=6.|.0.|.1.|.7.|.37.|.43.|.217.|.259.|.1297.|.1333.|.1519.|.1555.|..7777.| k=7.|.0.|.1.|.8.|.50.|.57.|.344.|.400.|.2402.|.2451.|.2752.|.2801.|.16808.| k=8.|.0.|.1.|.9.|.65.|.73.|.513.|.585.|.4097.|.4161.|.4617.|.4681.|.32769.| k=9.|.0.|.1.|.8.|.10.|.80.|..82.|..91.|..154.|..656.|..665.|..728.|...730.| k=10|.0.|.1.|.8.|.11.|.69.|..88.|..96.|..101.|..111.|..181.|..609.|...619.|A000787 ===================================================================================
strobo := proc(b,n) option remember; local a; if n <=2 then return n-1 ; elif b = 1 then return n-1 ; else for a from procname(b,n-1)+1 do isstrobo := true ; dgsa := convert(a,base,b) ; for d from 1 to nops(dgsa) do if op(d,dgsa)=1 and op(-d,dgsa) <> 1 then isstrobo := false; elif op(d,dgsa)=8 and op(-d,dgsa) <> 8 then isstrobo := false; elif op(d,dgsa)=6 and op(-d,dgsa) <> 9 then isstrobo := false; elif op(d,dgsa)=9 and op(-d,dgsa) <> 6 then isstrobo := false; elif op(d,dgsa)=0 and op(-d,dgsa) <> 0 then isstrobo := false; elif op(d,dgsa) in { 2,3,4,5,7} then isstrobo := false; end if; end do; if isstrobo then return a; end if; end do: end if; end proc: # R. J. Mathar, Sep 30 2011
is(n) = {my(d=digits(n),dr); if(d[#d]==0 || #setminus(Set(d),Set([0,1,6,8,9])) !=0, return(0), dr=vector(#d)); for(i=1,#d, dr[#d-i+1] = if(d[i]==6||d[i]==9,15-d[i],d[i]));dr!=d} \\ David A. Corneth, May 22 2016
13^2 = 169. A rotationally ambigrammatic number. Hence, 13 is a term. 15^2 = 225. Not rotationally ambigrammatic and hence 15 is not a term. 10^2 = 100. This number has trailing zeros, so under this definition of rotationally ambigrammatic, 10 is not a term.
Select[Range[0, 4001], (# == 0 || !Divisible[#, 10]) && AllTrue[IntegerDigits[#^2], MemberQ[{0, 1, 6, 8, 9}, #1] &] &] (* Amiram Eldar, Dec 26 2020 *)
isra(n) = (n%10) && (!setminus(Set(Vec(Str(n))), Vec("01689"))) || !n; \\ A045574 isok(n) = isra(n^2); \\ Michel Marcus, Dec 27 2020
Divisors[5130] (* Paolo Xausa, Aug 10 2024 *)
divisors(5130) \\ Charles R Greathouse IV, Sep 06 2016
I, II, III, X, XIX, XX, XXX.
Comments