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 10 results.

A068188 Tetradic primes (primes in A006072).

Original entry on oeis.org

11, 101, 181, 18181, 1008001, 1180811, 1880881, 1881881, 100111001, 100888001, 108101801, 110111011, 111010111, 111181111, 118818811, 180101081, 181111181, 181888181, 188010881, 188888881, 10008180001, 10081818001
Offset: 1

Views

Author

Eric W. Weisstein, Feb 18 2002

Keywords

Comments

Primes that are palindromes and use only the digits 0, 1 and 8, so they read the same backwards and upside down.
11 is the only term with an even number of digits. The number of terms for an odd number of digits (3-37) is: 2, 1, 4, 12, 26, 62, 173, 392, 1087, 3197, 8189, 23354, 65128, 181486, 514255, 1447637, 4052813, 11682721. That makes the number of terms less than 10^2n (n to 19): 1, 3, 4, 8, 20, 46, 108, 281, 673, 1760, 4957, 13146, 36500, 101628, 283114, 797369, 2245006, 6297819, 17980540. - Hans Havermann, Dec 16 2017

Crossrefs

Cf. A006072, subsequence of A030430.

Programs

  • Mathematica
    TetrPrmsUpTo10powerK[k_]:= Select[FromDigits/@ Tuples[{0,1,8}, k],
    PrimeQ[#] && IntegerDigits[#] == Reverse[IntegerDigits[#]] &]; TetrPrmsUpTo10powerK[13] (* Mikk Heidemaa, May 20 2017 *)

Extensions

Edited by Jud McCranie, Jun 02 2003
Offset corrected by Arkadiusz Wesolowski, Oct 17 2011

A118594 Palindromes in base 3 (written in base 3).

Original entry on oeis.org

0, 1, 2, 11, 22, 101, 111, 121, 202, 212, 222, 1001, 1111, 1221, 2002, 2112, 2222, 10001, 10101, 10201, 11011, 11111, 11211, 12021, 12121, 12221, 20002, 20102, 20202, 21012, 21112, 21212, 22022, 22122, 22222, 100001, 101101, 102201, 110011, 111111, 112211, 120021
Offset: 1

Views

Author

Martin Renner, May 08 2006

Keywords

Comments

The number of n-digit terms is given by A225367. - M. F. Hasler, May 05 2013 [Moved here on May 08 2013]
Digit-wise application of A000578 (and also superposition of a(n) with its horizontal OR vertical reflection) yields A006072. - M. F. Hasler, May 08 2013
Equivalently, palindromes k (written in base 10) such that 4*k is a palindrome. - Bruno Berselli, Sep 12 2018

Crossrefs

Programs

  • Mathematica
    (* get NextPalindrome from A029965 *) Select[NestList[NextPalindrome, 0, 1110], Max@IntegerDigits@# < 3 &] (* Robert G. Wilson v, May 09 2006 *)
    Select[FromDigits/@Tuples[{0,1,2},8],IntegerDigits[#]==Reverse[ IntegerDigits[ #]]&] (* Harvey P. Dale, Apr 20 2015 *)
  • PARI
    {for(l=1,5,u=vector((l+1)\2,i,10^(i-1)+(2*i-11&&i==1,2]), print1(v*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 08 2013
    
  • Python
    from itertools import count, islice, product
    def agen(): # generator of terms
        yield from [0, 1, 2]
        for d in count(2):
            for start in "12":
                for rest in product("012", repeat=d//2-1):
                    left = start + "".join(rest)
                    for mid in [[""], ["0", "1", "2"]][d%2]:
                        yield int(left + mid + left[::-1])
    print(list(islice(agen(), 42))) # Michael S. Branicky, Mar 29 2022
    
  • Python
    from sympy import integer_log
    from gmpy2 import digits
    def A118594(n):
        if n == 1: return 0
        y = 3*(x:=3**integer_log(n>>1,3)[0])
        return int((s:=digits(n-x,3))+s[-2::-1] if nChai Wah Wu, Jun 14 2024
  • Sage
    [int(n.str(base=3)) for n in (0..757) if Word(n.digits(3)).is_palindrome()] # Peter Luschny, Sep 13 2018
    

Extensions

More terms from Robert G. Wilson v, May 09 2006
a(40) and beyond from Michael S. Branicky, Mar 29 2022

A332180 a(n) = 8*(10^(2n+1)-1)/9 - 8*10^n.

Original entry on oeis.org

0, 808, 88088, 8880888, 888808888, 88888088888, 8888880888888, 888888808888888, 88888888088888888, 8888888880888888888, 888888888808888888888, 88888888888088888888888, 8888888888880888888888888, 888888888888808888888888888, 88888888888888088888888888888, 8888888888888880888888888888888
Offset: 0

Views

Author

M. F. Hasler, Feb 08 2020

Keywords

Crossrefs

Cf. A002275 (repunits R_n = (10^n-1)/9), A002282 (8*R_n), A011557 (10^n).
Cf. A138148 (cyclops numbers with binary digits only), A002113 (palindromes).
Cf. A332120 .. A332190 (variants with different repeated digit 2, ..., 9).
Cf. A332181 .. A332189 (variants with different middle digit 1, ..., 9).
Subsequence of A006072 (numbers with mirror symmetry about middle), A153806 (strobogrammatic cyclops numbers), and A204095 (numbers whose decimal digits are in {0,8}).

Programs

  • Maple
    A332180 := n -> 8*((10^(2*n+1)-1)/9-10^n);
  • Mathematica
    Array[8 ((10^(2 # + 1)-1)/9 - 10^#) &, 15, 0]
  • PARI
    apply( {A332180(n)=(10^(n*2+1)\9-10^n)*8}, [0..15])
    
  • Python
    def A332180(n): return (10**(n*2+1)//9-10**n)*8

Formula

a(n) = 8*A138148(n) = A002282(2n+1) - 8*10^n.
G.f.: 8*x*(101 - 200*x)/((1 - x)(1 - 10*x)(1 - 100*x)).
a(n) = 111*a(n-1) - 1110*a(n-2) + 1000*a(n-3) for n > 2.
E.g.f.: 8*exp(x)*(10*exp(99*x) - 9*exp(9*x) - 1)/9. - Stefano Spezia, Jul 13 2024

A117855 Number of nonzero palindromes of length n (in base 3).

Original entry on oeis.org

2, 2, 6, 6, 18, 18, 54, 54, 162, 162, 486, 486, 1458, 1458, 4374, 4374, 13122, 13122, 39366, 39366, 118098, 118098, 354294, 354294, 1062882, 1062882, 3188646, 3188646, 9565938, 9565938, 28697814, 28697814, 86093442, 86093442, 258280326, 258280326, 774840978
Offset: 1

Views

Author

Martin Renner, May 02 2006

Keywords

Comments

See A225367 for the sequence that counts all base 3 palindromes, including 0 (and thus also the number of n-digit terms in A006072). -- A nonzero palindrome of length L=2k-1 or of length L=2k is determined by the first k digits, which then determine the last k digits by symmetry. Since the first digit cannot be 0, there are 2*3^(k-1) possibilities. - M. F. Hasler, May 05 2013
From Gus Wiseman, Oct 18 2023: (Start)
Also the number of subsets of {1..n} with n not the sum of two subset elements (possibly the same). For example, the a(0) = 1 through a(4) = 6 subsets are:
{} {} {} {} {}
{1} {2} {1} {1}
{2} {3}
{3} {4}
{1,3} {1,4}
{2,3} {3,4}
For subsets with no subset summing to n we have A365377.
Requiring pairs to be distinct gives A068911, complement A365544.
The complement is counted by A366131.
(End) [Edited by Peter Munn, Nov 22 2023]

Examples

			The a(3)=6 palindromes of length 3 are: 101, 111, 121, 202, 212, and 222. - _M. F. Hasler_, May 05 2013
		

Crossrefs

Cf. A050683 and A070252.
Bisections are both A025192.
A093971/A088809/A364534 count certain types of sum-full subsets.
A108411 lists powers of 3 repeated, complement A167936.

Programs

  • Mathematica
    With[{c=NestList[3#&,2,20]},Riffle[c,c]] (* Harvey P. Dale, Mar 25 2018 *)
    Table[Length[Select[Subsets[Range[n]],!MemberQ[Total/@Tuples[#,2],n]&]],{n,0,10}] (* Gus Wiseman, Oct 18 2023 *)
  • PARI
    A117855(n)=2*3^((n-1)\2) \\ - M. F. Hasler, May 05 2013
    
  • Python
    def A117855(n): return 3**(n-1>>1)<<1 # Chai Wah Wu, Oct 28 2024

Formula

a(n) = 2*3^floor((n-1)/2).
a(n) = 2*A108411(n-1).
From Colin Barker, Feb 15 2013: (Start)
a(n) = 3*a(n-2).
G.f.: -2*x*(x+1)/(3*x^2-1). (End)

Extensions

More terms from Colin Barker, Feb 15 2013

A111575 Powers of 3 repeated four times.

Original entry on oeis.org

1, 1, 1, 1, 3, 3, 3, 3, 9, 9, 9, 9, 27, 27, 27, 27, 81, 81, 81, 81, 243, 243, 243, 243, 729, 729, 729, 729, 2187, 2187, 2187, 2187, 6561, 6561, 6561, 6561, 19683, 19683, 19683, 19683, 59049, 59049, 59049, 59049, 177147, 177147, 177147, 177147, 531441
Offset: 0

Views

Author

Jeremy Gardiner, Nov 17 2005

Keywords

Comments

Generating sequence for the number of 0's and 1's (run lengths) in the parity of A006072, A111065 and A118594.

Examples

			a(10) = 3^floor(10/4) = 3^2 = 9.
		

Crossrefs

Programs

Formula

a(n) = 3^floor(n/4).
O.g.f.: -(1+x)*(1+x^2)/(-1+3*x^4). - R. J. Mathar, Jan 08 2008

A111065 Numbers that look the same when rotated by 180 degrees, using only digits 0, 6 and 9.

Original entry on oeis.org

0, 69, 96, 609, 906, 6009, 6699, 6969, 9006, 9696, 9966, 60009, 66099, 69069, 90006, 96096, 99066, 600009, 606909, 609609, 660099, 666999, 669699, 690069, 696969, 699669, 900006, 906906, 909606, 960096, 966996, 969696, 990066, 996966, 999666, 6000009, 6060909
Offset: 1

Views

Author

Paul Stoeber (pstoeber(AT)uni-potsdam.de), Oct 08 2005

Keywords

Comments

Strobogrammatic numbers (A000787) without digits 1 or 8.
Apparently this sequence and A006072 have the same parity. - Jeremy Gardiner, Oct 15 2005
There are no primes in this sequence because all terms are divisible by 3. - M. F. Hasler, May 04 2012

Crossrefs

Cf. strobogrammatic numbers A000787. If 8's are included we get A111156.

Programs

  • 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 '9'='6';i('0':x)='6':x;i('6':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
    
  • Mathematica
    fQ[n_] := Block[{s = {0, 6, 9}, id = IntegerDigits[n]}, If[ Union[ Join[s, id]] == s && (id /. {6 -> 9, 9 -> 6}) == Reverse[id], True, False]]; Select[ Range[0, 10^6], fQ[ # ] &] (* Robert G. Wilson v, Oct 11 2005 *)
  • PARI
    is_A111065(n)=!setminus(Set(n=Vec(Str(n))),Vec("069")) & apply(t->Vec("096")[max(eval(t)/3,1)], n)==vecextract(n,"-1..1")  \\ M. F. Hasler, May 04 2012
    
  • 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 0
        for d in count(2):
            for start in "69":
                for rest in product("069", repeat=d//2-1):
                    left = start + "".join(rest)
                    right = ud(left)
                    for mid in [[""], ["0"]][d%2]:
                        yield int(left + mid + right)
    print(list(islice(agen(), 37))) # Michael S. Branicky, Mar 29 2022

Extensions

Offset corrected by Reinhard Zumkeller, Sep 26 2014
a(36) and beyond from Michael S. Branicky, Mar 29 2022

A225367 Number of palindromes of length n in base 3 (A118594).

Original entry on oeis.org

3, 2, 6, 6, 18, 18, 54, 54, 162, 162, 486, 486, 1458, 1458, 4374, 4374, 13122, 13122, 39366, 39366, 118098, 118098, 354294, 354294, 1062882, 1062882, 3188646, 3188646, 9565938, 9565938, 28697814, 28697814, 86093442, 86093442, 258280326, 258280326, 774840978
Offset: 1

Views

Author

M. F. Hasler, May 05 2013

Keywords

Comments

Also: The number of n-digit terms in A006072. See there for further comments.
A palindrome of length L=2k-1 or of length L=2k is determined by the first k digits, which then determine the last k digits by symmetry. Since the first digit cannot be 0 (unless L=1), there are 2*3^(k-1) possibilities for L>1.
Except for the initial term, this is identical to A117855, which counts only nonzero palindromes.

Examples

			The a(1)=3 palindromes of length 1 are: 0, 1 and 2.
The a(2)=2 palindromes of length 2 are: 11 and 22.
		

Crossrefs

Cf. A050683 and A070252 for base 10 analogs.

Programs

  • Magma
    [n eq 1 select 3 else 2*3^Floor((n-1)/2): n in [1..40]]; // Bruno Berselli, May 06 2013
    
  • Magma
    I:=[3,2,6]; [n le 3 select I[n] else 3*Self(n-2): n in [1..40]]; // Vincenzo Librandi, May 31 2017
    
  • Mathematica
    Join[{3}, LinearRecurrence[{0, 3}, {2, 6}, 40]] (* Vincenzo Librandi, May 31 2017 *)
  • PARI
    A225367(n)=2*3^((n-1)\2)+!n
    
  • Python
    def A225367(n): return 3 if n==1 else 3**(n-1>>1)<<1 # Chai Wah Wu, Jul 30 2025

Formula

a(n) = 2*3^floor((n-1)/2) + [n=1].
a(n) = 3*a(n-2) for n>3.
G.f.: x*(3*x^2-2*x-3)/(3*x^2-1).
a(n) = (6-(1+(-1)^n)*(3-sqrt(3)))*sqrt(3)^(n-3) for n>1, a(1)=3. [Bruno Berselli, May 06 2013]

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

A119742 Partial sum of tetradic primes (A068188).

Original entry on oeis.org

11, 112, 293, 18474, 1026475, 2207286, 4088167, 5970048, 106081049, 206969050, 315070851, 425181862, 536191973, 647373084, 766191895, 946292976, 1127404157, 1309292338, 1497303219, 1686192100, 11694372101, 21776190102
Offset: 1

Views

Author

Jonathan Vos Post, Jun 16 2006

Keywords

Comments

Tetradic primes are primes that are palindromes and use only the digits 0, 1 and 8, so they read the same backwards and upside down. a(1) = 11, a(3) = 293 and a(21) = 11694372101 are primes.

Examples

			a(21) = 11 + 101 + 181 + 18181 + 1008001 + 1180811 + 1880881 + 1881881 + 100111001 + 100888001 + 108101801 + 110111011 + 111010111 + 111181111 + 118818811 + 180101081 + 181111181 + 181888181 + 188010881 + 188888881 + 10008180001 = 11694372101.
		

Crossrefs

Formula

a(n) = SUM[i=1..n] A068188(i). a(n) = SUM[i=1..n] {A006072(k) such that A006072(k) is in A000040}.

Extensions

Corrected by Jens Kruse Andersen, Apr 27 2010

A287092 Strobogrammatic nonpalindromic numbers.

Original entry on oeis.org

69, 96, 609, 619, 689, 906, 916, 986, 1691, 1961, 6009, 6119, 6699, 6889, 6969, 8698, 8968, 9006, 9116, 9696, 9886, 9966, 16091, 16191, 16891, 19061, 19161, 19861, 60009, 60109, 60809, 61019, 61119, 61819, 66099, 66199, 66899, 68089, 68189, 68889, 69069, 69169, 69869, 86098, 86198, 86898, 89068, 89168
Offset: 1

Views

Author

Ilya Gutkovskiy, May 19 2017

Keywords

Comments

Nonpalindromic numbers which are invariant under a 180-degree rotation.
Numbers that are the same upside down and containing digits 6, 9.
Intersection of A000787 and A029742.
Union of this sequence and A006072 gives A000787.

Crossrefs

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, 89168], fQ[ # ] && ! PalindromeQ[ # ] &]
Showing 1-10 of 10 results.