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-4 of 4 results.

A168607 a(n) = 3^n + 2.

Original entry on oeis.org

3, 5, 11, 29, 83, 245, 731, 2189, 6563, 19685, 59051, 177149, 531443, 1594325, 4782971, 14348909, 43046723, 129140165, 387420491, 1162261469, 3486784403, 10460353205, 31381059611, 94143178829, 282429536483, 847288609445
Offset: 0

Views

Author

Vincenzo Librandi, Dec 01 2009

Keywords

Comments

Second bisection is A134752.
It appears that if s(n) is a first order rational sequence of the form s(1)=5, s(n)= (2*s(n-1)+1)/(s(n-1)+2),n>1, then s(n)= a(n)/(a(n)-4), n>1. - Gary Detlefs, Nov 16 2010
Mahler exhibits this sequence with n>=1 as a proof that there exists an infinite number of x coprime to 3, such that x belongs to A125293 and x^2 belongs to A005836. - Michel Marcus, Nov 12 2012

Crossrefs

Cf. A008776 (2*3^n), A005051 (8*3^n), A034472 (3^n+1), A000244 (powers of 3), A024023 (3^n-1), A168609 (3^n+4), A168610 (3^n+5), A134752 (3^(2*n-1)+2).

Programs

Formula

a(n) = 3*a(n-1) - 4, a(0) = 3.
a(n+1) - a(n) = A008776(n).
a(n+2) - a(n) = A005051(n).
a(n) = A034472(n)+1 = A000244(n)+2 = A024023(n)+3 = A168609(n)-2 = A168610(n)-3.
G.f.: (3 - 7*x)/((1 - x)*(1 - 3*x)).
a(n) = 4*a(n-1) - 3*a(n-2), a(0) = 3, a(1) = 5. - Vincenzo Librandi, Feb 06 2013
E.g.f.: exp(3*x) + 2*exp(x). - Elmo R. Oliveira, Nov 09 2023

Extensions

Edited by Klaus Brockhaus, Apr 13 2010
Further edited by N. J. A. Sloane, Aug 10 2010

A340131 Numbers whose ternary expansions have the same number of 1's and 2's and, in each prefix (initial fragment), at least as many 1's as 2's.

Original entry on oeis.org

0, 5, 11, 15, 29, 33, 44, 45, 50, 83, 87, 98, 99, 104, 116, 128, 132, 135, 140, 146, 150, 245, 249, 260, 261, 266, 278, 290, 294, 297, 302, 308, 312, 332, 344, 348, 377, 380, 384, 395, 396, 401, 405, 410, 416, 420, 434, 438, 449, 450, 455, 731, 735, 746, 747
Offset: 1

Views

Author

Gennady Eremin, Dec 29 2020

Keywords

Comments

For a nonzero term, the ternary code starts with 1, otherwise the balance of 1's and 2's is broken already in the one-digit prefix. Therefore 7, 19, 21, etc. (see A039001) are not terms.
As another example, for the integer 52 the balance is broken in the three-digit prefix 122 (the entire ternary code is 1221).
Each term with a ternary code of length k corresponds one-to-one to the Motzkin path of length k that starts with an up step. Therefore, the terms can be called digitized Motzkin paths.
The number of terms with a ternary code of length k is equal to A244884(k). Example: five terms 29, 33, 44, 45 and 50 have a ternary length of 4, respectively A244884(4)=5.

Examples

			The first terms 0 and 5 are obvious, because the four intermediate ternary codes 1, 2, 10[3], and 11[4] are rejected due to a violation of the balance of 1's and 2's. Next, the successor function S works: for any term x, the next term is S(x).
Iterating over numbers is inefficient; code suffixes (final digits) can be processed faster. The transition from 0 to 12[5] is generalized for terms that are multiples of 9. For example,
S(10200[99]) = 10212[104], S(1122000[1188]) = 1122012[1193], etc.
In this case, the calculation of the subsequent term is reduced to simply replacing the suffix s = 00 with the subsequent suffix s'= 12.
Another common suffix is s = 02..2 = 02^k (twos are repeated at the end of the ternary code). Then the subsequent suffix is s'= 202..2 = 202^(k-1), i.e., within such a suffix, the first two digits are reversed. Here are some examples:
k = 1, S(1002[29]) = 1020[33], the increment is 4*3^0 = 4;
k = 2, S(110022[332]) = 110202[344], the increment is 4*3^1 = 12;
k = 3, S(10110222[2537]) = 10112022[2573], the increment is 4*3^2 = 36;
k = 4, S(111102222[9800]) = 111120222[9908], the increment is 4*3^3 = 108.
There are 5 such group suffixes.
		

Crossrefs

Subsequence of A039001.
Subsequences: A134752, A168607.
Cf. A244884.

Programs

  • PARI
    is(n) = {my(d = digits(n, 3), v = [0, 0]); for(i = 1, #d, if(d[i] > 0, v[d[i]]++); if(v[1] < v[2], return(0))); v[1] == v[2] } \\ David A. Corneth, Dec 29 2020
    
  • Python
    def digits(n, b):
      out = []
      while n >= b:
        out.append(n % b)
        n //= b
      return [n] + out[::-1]
    def ok(n):
      t = digits(n, 3)
      if t.count(1) != t.count(2): return False
      return all(t[:i].count(1) >= t[:i].count(2) for i in range(1, len(t)))
    print([n for n in range(750) if ok(n)]) # Michael S. Branicky, Dec 29 2020

A134753 Numbers k such that 3^(2*k-1) + 2 is prime.

Original entry on oeis.org

1, 2, 8, 32, 62, 70, 118, 122, 158, 182, 196, 566, 752, 3602, 21896, 22768, 53072
Offset: 1

Views

Author

N. J. A. Sloane, Jan 28 2008

Keywords

Comments

From Enrique Pérez Herrero, Jul 29 2010: (Start)
With: f(n)=3^(2n-1)+2, the non-primality of f(n) is settled when:
if 2 does not divide n, 5 divides f(n) (n>1)
if 3 divides n, 7 divides f(n)
if 5 divides n-4, 11 divides f(n)
if 14 divides n-2, 29 divides f(n)
if 15 divides n-5, 31 divides f(n). (End)

References

Crossrefs

Programs

Formula

({odd terms in A051783} + 1)/2.

Extensions

Typo in prime search corrected Enrique Pérez Herrero, Jul 31 2010
a(15)-a(17) from A051783 by Ray Chandler, Aug 06 2011

A340544 Numbers from A340131 that are not multiples of 3.

Original entry on oeis.org

5, 11, 29, 44, 50, 83, 98, 104, 116, 128, 140, 146, 245, 260, 266, 278, 290, 302, 308, 332, 344, 377, 380, 395, 401, 410, 416, 434, 449, 455, 731, 746, 752, 764, 776, 788, 794, 818, 830, 863, 866, 881, 887, 896, 902, 920, 935, 941, 980, 992, 1025, 1028, 1043
Offset: 1

Views

Author

Gennady Eremin, Jan 11 2021

Keywords

Comments

Terms are reduced, i.e., ternary codes do not have trailing zeros.
The term is a digitized Motzkin path that starts with an up step and ends with a down step. Such a path has neither leading nor final flat steps, i.e., the ternary code of the corresponding term has no finite 0's. Recall that in ternary code, 1's are up steps, and 2's are down steps.
The number of terms with a ternary code of length k is A026107(k-1). For instance, 7 (seven) reduced terms 83, 98, 104, 116, 128, 140, and 146 have a ternary length of 5, namely 10002, 10122, 10212, 11022, 11202, 12012, and 12102. Respectively A026107(4) = 7.

Crossrefs

Intersection of A001651 and A340131.
Subsequences: A134752, A168607.
Cf. A026107.

Programs

  • Python
    def digits(n, b):
      out = []
      while n >= b:
        out.append(n % b)
        n //= b
      return [n] + out[::-1]
    def ok(n):
      if n%3 == 0: return False
      t = digits(n, 3)
      if t.count(1) != t.count(2): return False
      return all(t[:i].count(1) >= t[:i].count(2) for i in range(1, len(t)))
    print([n for n in range(750) if ok(n)]) # after Michael S. Branicky (A340131)
Showing 1-4 of 4 results.