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.

Showing 1-10 of 15 results. Next

A000787 Strobogrammatic numbers: the same upside down.

Original entry on oeis.org

0, 1, 8, 11, 69, 88, 96, 101, 111, 181, 609, 619, 689, 808, 818, 888, 906, 916, 986, 1001, 1111, 1691, 1881, 1961, 6009, 6119, 6699, 6889, 6969, 8008, 8118, 8698, 8888, 8968, 9006, 9116, 9696, 9886, 9966, 10001, 10101, 10801, 11011, 11111, 11811, 16091, 16191
Offset: 1

Views

Author

Keywords

Comments

Strobogrammatic numbers are a kind of ambigrams that retain the same meaning when viewed upside down. - Daniel Mondot, Sep 27 2016
"Upside down" here means rotated by 180 degrees (i.e., central symmetry), NOT "vertically flipped" (symmetry w.r.t. horizontal line, which are in A045574). - M. F. Hasler, May 04 2012

References

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

Crossrefs

Cf. A007597 (Primes in this sequence), A057770, A111065, A169731 (another version).
Subsequence of A045574. - M. F. Hasler, May 04 2012

Programs

  • Mathematica
    fQ[n_] := Block[{s = {0, 1, 6, 8, 9}, id = IntegerDigits[n]}, If[ Union[ Join[s, id]] == s && (id /. {6 -> 9, 9 -> 6}) == Reverse[id], True, False]]; Select[ Range[0, 16190], fQ[ # ] &] (* Robert G. Wilson v, Oct 11 2005 *)
  • Python
    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, 8]
        for d in count(2):
            for start in "1689":
                for rest in product("01689", repeat=d//2-1):
                    left = start + "".join(rest)
                    right = ud(left)
                    for mid in [[""], ["0", "1", "8"]][d%2]:
                        yield int(left + mid + right)
    print(list(islice(agen(), 47))) # Michael S. Branicky, Mar 29 2022

Extensions

More terms from Robert G. Wilson v, Oct 11 2005

A153806 Strobogrammatic cyclops numbers.

Original entry on oeis.org

0, 101, 609, 808, 906, 11011, 16091, 18081, 19061, 61019, 66099, 68089, 69069, 81018, 86098, 88088, 89068, 91016, 96096, 98086, 99066, 1110111, 1160911, 1180811, 1190611, 1610191, 1660991, 1680891, 1690691, 1810181, 1860981
Offset: 1

Views

Author

Omar E. Pol, Jan 15 2009

Keywords

Comments

Intersection of A000787 and A134808.

Examples

			1680891 is a member because it is the same upside down (A000787) and also a cyclops number (A134808).
		

Crossrefs

Programs

  • Mathematica
    Select[Range[10^7], And[OddQ@ Length@#, Part[#, Ceiling[Length[#]/2]] == 0, Times @@ Boole@ Map[MemberQ[{0, 1, 6, 8, 9}, #] &, Union@ #] == 1, Count[#, 0] == 1, (Take[#, Floor[Length[#]/2]] /. {6 -> 9, 9 -> 6}) ==
    Reverse@ Take[#, -Floor[Length[#]/2]]] &@ IntegerDigits@ # &] (* Michael De Vlieger, Jul 05 2016 *)
  • Python
    import sys
    f = open('b153806.txt', 'w')
    i = 1
    n = 0
    a = [""]
    r = [""]  #reversed strobogrammatically
    while True:
        for x,y in zip(a,r):
            f.write(str(i)+" "+x+"0"+y+"\n")
            i += 1
            if i>20000:
                f.close()
                sys.exit()
        a = sum([[x+"1",x+"6",x+"8",x+"9"] for x in a],[])
        r = sum([["1"+x,"9"+x,"8"+x,"6"+x] for x in r],[])
    # Kenny Lau, Jul 05 2016

Extensions

Extended beyond 11011 by R. J. Mathar, Jan 17 2009

A018847 Strobogrammatic primes: the same upside down (calculator-style numerals).

Original entry on oeis.org

2, 5, 11, 101, 151, 181, 619, 659, 6229, 10501, 12821, 15551, 16091, 18181, 19861, 60209, 60509, 61519, 61819, 62129, 116911, 119611, 160091, 169691, 191161, 196961, 605509, 620029, 625529, 626929, 650059, 655559, 656959, 682289, 686989, 688889
Offset: 1

Views

Author

Keywords

Comments

This is the subsequence of primes in A018846. - M. F. Hasler, May 05 2012

Crossrefs

Cf. A007597 (more restrictive version not allowing digits 2 or 5).

Programs

  • Mathematica
    lst = {}; fQ[n_] := Block[{allset = {0, 1, 2, 5, 6, 8, 9}, id = IntegerDigits@n}, Union@ Join[id, allset] == allset && Reverse[id /. {6 -> 9, 9 -> 6}] == id]; Do[ If[ PrimeQ@n && fQ@n, AppendTo[lst, n]], {n, 700000}]; lst (* Robert G. Wilson v, Feb 27 2007 *)
  • PARI
    {write("/tmp/b018847.txt","1 2\n2 5"); c=2; s2=[0,1,2,5,6,8,9]; s=[0,1,2,5,8]; s1=[0,1,2,5,9,8,6]; for(n=2,9, p1=vector( (n+1)\2, i, 10^(i-1)); p2=vector( (n+1)\2, i, 10^(n-i)); forvec( v=vector((n+1)\2,i,if( i>1, [ 1,if( i>n\2, #s, #s1)], [2,5])), v[1]==3 & v[1]=5; ispseudoprime( t=sum(i=1,n\2,p1[i]*s1[v[i]]+p2[i]*s2[v[i]] ) +if(n%2,p1[#p1]*s[v[#v]] )) & /* print1(t",") */ write("/tmp/b018847.txt",c++" "t)))} \\ - M. F. Hasler, Apr 26 2012
    
  • PARI
    is_A018847(n,t=Vec("012..59.86"))={ isprime(n) & apply(x->t[eval(x)+1], n=Vec(Str(n)))==vecextract(n, "-1..1") } \\ - M. F. Hasler, May 05 2012
    
  • Python
    from itertools import count, islice
    from sympy import isprime
    def A018847_gen(): # generator of terms
        r, t, u = ''.maketrans('69','96'), set('0125689'), {0,1,2,5,8}
        for x in count(1):
            for y in range(10**(x-1),10**x):
                if y%10 in u:
                    s = str(y)
                    if set(s) <= t and isprime(m:=int(s+s[-2::-1].translate(r))):
                        yield m
            for y in range(10**(x-1),10**x):
                s = str(y)
                if set(s) <= t and isprime(m:=int(s+s[::-1].translate(r))):
                    yield m
    A018847_list = list(islice(A018847_gen(),20)) # Chai Wah Wu, Apr 09 2024

A048890 Primes that yield a different prime when rotated by 180 degrees.

Original entry on oeis.org

19, 61, 109, 199, 601, 661, 1019, 1061, 1091, 1109, 1181, 1601, 1609, 1669, 1699, 1811, 1901, 1999, 6011, 6091, 6101, 6199, 6619, 6661, 6689, 6691, 6899, 6991, 10061, 10069, 10091, 10691, 10861, 10909, 11069, 11681, 11909, 16001, 16619, 16661
Offset: 1

Views

Author

Keywords

Comments

Also called invertible primes. [Lekraj Beedassy, Jan 03 2009]

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr)
    a048890 n = a048890_list !! (n-1)
    a048890_list = filter f a000040_list where
       f x = all (`elem` [0,1,6,8,9]) ds && x' /= x && a010051 x' == 1
         where x' = foldl c 0 ds
               c v 6 = 10*v + 9; c v 9 = 10*v + 6; c v d = 10*v + d
               ds = unfoldr d x
               d z = if z == 0 then Nothing else Just $ swap $ divMod z 10
    -- Reinhard Zumkeller, Nov 18 2011
    
  • Mathematica
    lst = {}; fQ[n_] := Block[{allset = {0, 1, 6, 8, 9}, id = IntegerDigits@n}, rid = Reverse[id /. {6 -> 9, 9 -> 6}]; Union@ Join[id, allset] == allset && PrimeQ@ FromDigits@ rid && rid != id]; Do[ If[ PrimeQ@n && fQ@n, AppendTo[lst, n]], {n, 16900}]; lst (* Robert G. Wilson v, Feb 27 2007 *)
  • Python
    from itertools import product
    from sympy import isprime
    A048890_list = []
    for d in product('01689',repeat=6):
        s = ''.join(d)
        p = int(s)
        if p > 0:
            q = int(s[::-1].rstrip('0').translate(''.maketrans('69','96')))
            if p != q and isprime(q) and isprime(p):
                A048890_list.append(p) # Chai Wah Wu, Sep 13 2021

Extensions

Better definition and more terms from Robert G. Wilson v, Feb 27 2007

A153807 Strobogrammatic cyclops primes.

Original entry on oeis.org

101, 16091, 1160911, 1180811, 1190611, 1690691, 1880881, 1960961, 1990661, 6110119, 6610199, 6860989, 166906991, 168101891, 169609691, 188906881, 189808681, 196906961, 199609661, 616906919, 661609199, 666101999, 668609899
Offset: 1

Views

Author

Omar E. Pol, Jan 15 2009

Keywords

Comments

Primes in A153806.

Crossrefs

Extensions

Extended by Ray Chandler, May 20 2009

A080788 Primes that are still primes when turned upsided down.

Original entry on oeis.org

11, 19, 61, 101, 109, 181, 199, 601, 619, 661, 1019, 1061, 1091, 1109, 1181, 1601, 1609, 1669, 1699, 1811, 1901, 1999, 6011, 6091, 6101, 6199, 6619, 6661, 6689, 6691, 6899, 6991, 10061, 10069, 10091, 10691, 10861, 10909, 11069, 11681, 11909, 16001, 16091
Offset: 1

Views

Author

P. Giannopoulos (pgiannop1(AT)yahoo.com), Mar 12 2003

Keywords

References

  • P. Giannopoulos, The Brainteasers, unpublished.

Crossrefs

Programs

  • Haskell
    import Data.List (unfoldr)
    a048890 n = a048890_list !! (n-1)
    a048890_list = filter f a000040_list where
       f x = all (`elem` [0,1,6,8,9]) ds && x' /= x && a010051 x' == 1
         where x' = foldl c 0 ds
               c v 6 = 10*v + 9; c v 9 = 10*v + 6; c v d = 10*v + d
               ds = unfoldr d x
               d z = if z == 0 then Nothing else Just $ swap $ divMod z 10
    -- Reinhard Zumkeller, Nov 18 2011
    
  • Python
    from sympy import isprime
    from itertools import product
    def ud(s):
        return s[::-1].translate({ord('6'):ord('9'), ord('9'):ord('6')})
    def auptod(maxdigits):
        alst = []
        for d in range(1, maxdigits+1):
            for p in product("01689", repeat=d-1):
                if d > 1 and p[0] == "0": continue
                for end in "19":
                    s = "".join(p) + end
                    t, udt = int(s), int(ud(s))
                    if isprime(t) and isprime(udt): alst.append(t)
        return alst
    print(auptod(5)) # Michael S. Branicky, Nov 19 2021

Extensions

Missing 1669 and 6689 inserted by Reinhard Zumkeller, Nov 18 2011

A133207 Strobogrammatic non-palindromic primes.

Original entry on oeis.org

619, 16091, 19861, 61819, 116911, 119611, 160091, 169691, 191161, 196961, 686989, 688889, 1068901, 1160911, 1190611, 1191611, 1681891, 1690691, 1898681, 1908061, 1960961, 1990661, 6081809, 6100019, 6108019, 6110119, 6608099, 6610199
Offset: 1

Views

Author

Tanya Khovanova, Oct 10 2007

Keywords

Comments

Primes which are invariant under a 180-degree rotation, but do not have a mirror symmetry.

Crossrefs

Cf. The elements of this sequence are the elements of A007597 (Strobogrammatic primes) excluding the elements of A068188 (Tetradic primes).

Programs

  • Mathematica
    Select[Range[10000000], PrimeQ[ # ] && Union[IntegerDigits[ # ], {0, 1, 6, 8, 9}] == {0, 1, 6, 8, 9} && Reverse[IntegerDigits[ # ] /. {6 -> 9, 9 -> 6} ] == IntegerDigits[ # ] && Reverse[IntegerDigits[ # ]] != IntegerDigits[ # ] &]

A155584 Array, read by antidiagonals, of n-th strobogrammatic number in base k.

Original entry on oeis.org

0, 0, 1, 0, 1, 2, 0, 1, 3, 3, 0, 1, 4, 5, 4, 0, 1, 5, 10, 7, 5, 0, 1, 6, 17, 13, 9, 6, 0, 1, 7, 26, 21, 28, 15, 7, 0, 1, 8, 37, 31, 65, 40, 17, 8, 0, 1, 9, 50, 43, 126, 85, 82, 21, 9, 0, 1, 8, 65, 57, 217, 156, 257, 91, 27, 10, 0, 1, 8, 10, 73, 344, 259, 626, 273, 112, 31, 11, 0, 1, 8, 11, 80, 513, 400, 1297, 651, 325, 121, 33, 12
Offset: 1

Views

Author

Jonathan Vos Post, Jan 24 2009

Keywords

Comments

If a binary number is palindromic, it is also strobogrammatic. In bases 3 through 7, this is not true, where only digits 0 and 1 can be used, because 8 is not a digit, nor are either of the inversion paid (6,9). I do not show bases beyond 10, although admittedly some letters as digits are other letters upside-down.

Examples

			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
===================================================================================
		

Crossrefs

Programs

  • Maple
    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

A274831 Strobogrammatic (A000787) composite numbers whose prime factors are strobogrammatic as well.

Original entry on oeis.org

1111, 11088011, 16169191, 101808101, 616101919, 668808899, 686808989, 1016969101, 1106699011, 1199006611, 6068888909, 6699116699, 6699886699, 11990006611, 16168089191, 19190006161, 19198086161, 66110001199, 66880008899, 110668899011, 161600009191
Offset: 1

Views

Author

Keywords

Comments

The smallest term which is the product of 3 primes is 1111008888001111 = 11 * 101 * 1000008000001. The smallest term which is not a multiple of 11 or 101 is a(790) = 100111801888108111001 = 100111001 * 1000008000001.

Examples

			16169191 is a term because it is equal to 101 * 160091.
		

Crossrefs

A370447 Palindromic prime numbers that consist only of the digits {0,1,6,8,9} and which remain palindromic primes when their digits are rotated by 180 degrees.

Original entry on oeis.org

11, 101, 181, 16661, 18181, 19991, 1008001, 1160611, 1180811, 1190911, 1688861, 1880881, 1881881, 1988891, 100111001, 100888001, 101616101, 101919101, 106111601, 106191601, 108101801, 109111901, 109161901, 110111011, 111010111, 111181111, 116010611, 116696611
Offset: 1

Views

Author

Jean-Marc Rebert, Feb 18 2024

Keywords

Comments

10886968801 is the least palindromic prime of this sequence for which the set of digits is {0,1,6,8,9}.
Terms must start and end with digit 1 and be of odd length for n > 1. - Michael S. Branicky, Feb 19 2024

Examples

			16661 becomes 19991 under such a rotation, and both are palindromic primes.
		

Crossrefs

Subsequence of palindromes in A007597.

Programs

  • PARI
    rot(u)=my(v=[]);for(i=1,#u,my(x=u[i]);if(x==6,v=concat(9,v),x==9,v=concat(6,v),vecsearch([0,1,8],x)>0,v=concat(x,v)));v
    is(x)=my(u=digits(x),su=Set(u));if(setintersect(su,Set([0,1,6,8,9]))!=su||!isprime(x)||Vecrev(u)!=u,return(0));my(y=fromdigits(rot(u)));return(isprime(y))
    
  • Python
    from sympy import isprime
    from itertools import product, count, islice
    def flip180(s): return s[::-1].translate({54:57, 57:54})
    def agen(): # generator of terms
        yield 11
        for digits in count(3, 2):
            for rest in product("01689", repeat=digits//2-1):
                for mid in "01689":
                    s = "".join(("1",)+rest+(mid,)+rest[::-1]+("1",))
                    if isprime(t:=int(s)) and isprime(int(flip180(s))):
                        yield t
    print(list(islice(agen(), 28))) # Michael S. Branicky, Feb 19 2024
Showing 1-10 of 15 results. Next