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 13 results. Next

A253208 a(n) = 4^n + 3.

Original entry on oeis.org

4, 7, 19, 67, 259, 1027, 4099, 16387, 65539, 262147, 1048579, 4194307, 16777219, 67108867, 268435459, 1073741827, 4294967299, 17179869187, 68719476739, 274877906947, 1099511627779, 4398046511107, 17592186044419, 70368744177667, 281474976710659
Offset: 0

Views

Author

Vincenzo Librandi, Dec 29 2014

Keywords

Comments

Subsequence of A226807.

Crossrefs

Cf. Numbers of the form k^n+k-1: A000057 (k=2), A168607 (k=3), this sequence (k=4), A242329 (k=5), A253209 (k=6), A253210 (k=7), A253211 (k=8), A253212 (k=9), A253213 (k=10).

Programs

  • Magma
    [4^n+3: n in [0..30]];
    
  • Mathematica
    Table[4^n + 3, {n, 0, 30}] (* or *) CoefficientList[Series[(4 - 13 x) / ((1 - x) (1 - 4 x)), {x, 0, 40}], x]
  • PARI
    a(n)=4^n+3 \\ Charles R Greathouse IV, Oct 07 2015

Formula

G.f.: (4 - 13*x)/((1 - x)*(1 - 4*x)).
a(n) = 5*a(n-1) - 4*a(n-2) for n > 1.
From Elmo R. Oliveira, Nov 14 2023: (Start)
a(n) = 4*a(n-1) - 9 with a(0) = 4.
E.g.f.: exp(4*x) + 3*exp(x). (End)

A178674 a(n) = 3^n + 3.

Original entry on oeis.org

4, 6, 12, 30, 84, 246, 732, 2190, 6564, 19686, 59052, 177150, 531444, 1594326, 4782972, 14348910, 43046724, 129140166, 387420492, 1162261470, 3486784404, 10460353206, 31381059612, 94143178830, 282429536484, 847288609446, 2541865828332, 7625597484990, 22876792454964
Offset: 0

Views

Author

Vincenzo Librandi, Dec 25 2010

Keywords

Comments

a(n) is the deficiency of 3^n * 5. - Patrick J. McNab, May 27 2017

Crossrefs

Programs

  • GAP
    List([0..40], n -> 3^n+3); # G. C. Greubel, Jan 27 2019
  • Magma
    [3^n+3: n in [0..35]];
    
  • Mathematica
    Table[3^n+3, {n, 0, 40}] (* or *) CoefficientList[Series[(4-10x)/((1-x) (1-3x)), {x, 0, 30}], x] (* Vincenzo Librandi, May 13 2014 *)
  • PARI
    a(n)=3^n+3 \\ Charles R Greathouse IV, Oct 07 2015
    
  • Sage
    [3^n+3 for n in range(40)] # G. C. Greubel, Jan 27 2019
    

Formula

a(n) = 3*(a(n-1) - 2), a(0)=4.
From R. J. Mathar, Jan 05 2011: (Start)
G.f.: (4-10*x)/((1-3*x)*(1-x)).
a(n) = 2*A115098(n). (End)
a(n) = 4*a(n-1) - 3*a(n-2) for n > 1. - Vincenzo Librandi, May 13 2014
E.g.f.: exp(x)*(exp(2*x) + 3). - Elmo R. Oliveira, Apr 02 2025

A168609 a(n) = 3^n + 4.

Original entry on oeis.org

5, 7, 13, 31, 85, 247, 733, 2191, 6565, 19687, 59053, 177151, 531445, 1594327, 4782973, 14348911, 43046725, 129140167, 387420493, 1162261471, 3486784405, 10460353207, 31381059613, 94143178831, 282429536485, 847288609447
Offset: 0

Views

Author

Vincenzo Librandi, Dec 01 2009

Keywords

Examples

			a(1)=3*5-8=7; a(2)=3*7-8=13; a(3)=3*13-8=31.
		

Crossrefs

Programs

Formula

a(n) = 3*a(n-1) - 8, with n>0, a(0)=5.
G.f.: (5 - 13*x)/((1-x)*(1-3 x)). - Vincenzo Librandi, May 13 2014
a(n) = 4*a(n-1) - 3*a(n-2) for n>1. - Vincenzo Librandi, May 13 2014
E.g.f.: exp(3*x) + 4*exp(x). - G. C. Greubel, Jul 27 2016

Extensions

Formula and examples edited to use correct offset by Jon E. Schoenfield, Jun 19 2010

A301913 Primes which divide numbers of the form 3^k + 2 for k >= 1.

Original entry on oeis.org

5, 7, 11, 17, 19, 29, 31, 43, 53, 59, 79, 83, 89, 97, 101, 107, 113, 127, 131, 137, 139, 149, 163, 173, 179, 197, 199, 211, 223, 227, 233, 241, 251, 257, 269, 281, 283, 293, 317, 331, 337, 347, 353, 379, 389, 401, 409, 419, 439, 443, 449, 457, 461, 463, 467
Offset: 1

Views

Author

Luke W. Richards, Mar 28 2018

Keywords

Comments

The first odd prime not to appear in the sequence is 3 because 3^k + 2 == 2 mod 3 for k >= 1.
Primes p such that the order of -2 (mod p) divides the order of 3 (mod p). - Joerg Arndt, Mar 31 2018, corrected by Robert Israel, May 04 2018

Examples

			5 divides 245 which is 3^5+2 so 5 is in the sequence.
7 divides 245 which is 3^5+2 so 7 is in the sequence.
The values of x = (3^k+2) mod 13 for k = 0, 1, 2, 3, ... are 3, 5, 11, 3, 5, 11, ...; 13 never divides any 3^k + 2, so 13 is not in the sequence.
		

Crossrefs

Cf. A168607.

Programs

  • Maple
    select(t -> numtheory:-mlog(-2,3,t)<>FAIL, [seq(ithprime(i),i=3..100)]);
  • Mathematica
    fQ[p_] := IntegerQ@ MultiplicativeOrder[3, p, -2]; Select[ Prime@ Range@ 100, fQ] (* Robert G. Wilson v, Apr 07 2018 *)
  • PARI
    is(n)=n>4 && isprime(n) && znorder(Mod(-2,n))%znorder(Mod(3,n))==0 \\ Charles R Greathouse IV, May 04 2018

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

A176260 Periodic sequence: Repeat 5, 1.

Original entry on oeis.org

5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5, 1, 5
Offset: 0

Views

Author

Klaus Brockhaus, Apr 13 2010

Keywords

Comments

Interleaving of A010716 and A000012.
Also continued fraction expansion of (5+3*sqrt(5))/2.
Also decimal expansion of 17/33.
Essentially first differences of A047264.
Binomial transform of 5 followed by -A122803 without initial terms 1, -2.
Inverse binomial transform of 5 followed by A007283 without initial term 3.
Second inverse binomial transform of A168607 without initial term 3.
Exp( Sum_{n >= 1} a(n)*x^n/n ) = 1 + x + 3*x^2 + 3*x^3 + 6*x^4 + 6*x^5 + ... is the o.g.f. for A008805. - Peter Bala, Mar 13 2015

Crossrefs

Cf. A010716 (all 5's sequence), A000012 (all 1's sequence), A090550 (decimal expansion of (5+3*sqrt(5))/2), A010686 (repeat 1, 5), A047264 (congruent to 0 or 5 mod 6), A122803 (powers of -2), A007283 (3*2^n), A168607 (3^n+2), A008805.

Programs

  • Magma
    &cat[ [5, 1]: n in [0..52] ];
    [ 3+2*(-1)^n: n in [0..104] ];

Formula

a(n) = 3+2*(-1)^n.
a(n) = a(n-2) for n > 1; a(0) = 5, a(1) = 1.
a(n) = -a(n-1)+6 for n > 0; a(0) = 5.
a(n) = 5*((n+1) mod 2)+(n mod 2).
a(n) = A010686(n+1).
G.f.: (5+x)/(1-x^2).
From Amiram Eldar, Jan 01 2023: (Start)
Multiplicative with a(2^e) = 5, and a(p^e) = 1 for p >= 3.
Dirichlet g.f.: zeta(s)*(1+2^(2-s)). (End)
E.g.f.: 5*cosh(x) + sinh(x). - Stefano Spezia, Feb 09 2025

A298827 a(n) is the smallest positive integer k such that 3^n+2 divides 3^(n+k)+2.

Original entry on oeis.org

4, 5, 28, 41, 84, 336, 990, 193, 1260, 5905, 75918, 10065, 318860, 2391485, 14348908, 20390382, 5031420, 31624326, 5985168, 1743333144, 8569036, 668070480, 547062516, 141214768241, 167874004756, 1270932914165, 385131186110, 2837770056420, 784347169884, 475536631360, 149093578413164, 139370386996590
Offset: 1

Views

Author

Luke W. Richards, Jan 27 2018

Keywords

Comments

3^n+2 divides 3^(n+a(n)*m)+2 for all nonnegative integers m.
Jon E. Schoenfield noted that a(n) coincides with the multiplicative order of 3 modulo 3^n+2. This is true because 3^(n+a(n)) == 3^n mod 3^n+2 and since 3^n and 3^n+2 are coprime, 3^a(n) == 1 mod 3^n+2 and the multiplicative order is the smallest positive such number. - Chai Wah Wu, Jan 29 2018

Examples

			For n = 1, f(1) = 3^1 + 2 = 5, where f(x) = 3^x + 2. Given the last digits of f(x) form a recurring sequence of 5, 1, 9, 3 [, 5, 1, 9, 3] then whenever x = 1 mod 4, f(x) will be a multiple of f(1).
For n = 2, f(2) = 3^2 + 2 = 11. a(2) = 5. So any x = 2 mod 5 will be a multiple of 11. For instance, 27 = 2 mod 5, and f(27) = 3^27 + 2 = 7625597474989 = 11 * 693236134999.
		

Crossrefs

Cf. A168607.

Programs

  • Magma
    [Modorder(3,3^n+2): n in [1..29]]; // Jon E. Schoenfield, Jan 28 2018
    
  • Maple
    seq(numtheory:-order(3, 3^n+2), n=1..100); # Robert Israel, Feb 05 2018
  • Mathematica
    Array[Block[{k = 1}, While[! Divisible[3^(# + k) + 2, 3^# + 2], k++]; k] &, 12] (* Michael De Vlieger, Feb 05 2018 *)
    Table[MultiplicativeOrder[3, 3^n + 2], {n, 32}] (* Jean-François Alcover, Feb 06 2018 *)
  • PARI
    a(n) = znorder(Mod(3, 3^n+2)); \\ Michel Marcus, Jan 29 2018
  • Python
    def fmod(n, mod):
        return (pow(3, n, mod) + 2) % mod
    def f(n):
        return pow(3, n) + 2
    #terms is the number of terms to generate
    terms = 20
    for x in range(1, terms + 1):
        div = f(x)
        y = x + 1
        while fmod(y, div) != 0:
            y += 1
        print(y - x)
    
  • Python
    from sympy import n_order
    def A298827(n):
        return n_order(3,3**n+2) # Chai Wah Wu, Jan 29 2018
    

Extensions

a(22)-a(32) from Robert Israel, Feb 05 2018

A323767 A(n,k) = Sum_{j=0..floor(n/2)} binomial(n-j,j)^k, square array A(n,k) read by antidiagonals, for n >= 0, k >= 0.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 1, 1, 2, 2, 1, 1, 2, 3, 3, 1, 1, 2, 5, 5, 3, 1, 1, 2, 9, 11, 8, 4, 1, 1, 2, 17, 29, 26, 13, 4, 1, 1, 2, 33, 83, 92, 63, 21, 5, 1, 1, 2, 65, 245, 338, 343, 153, 34, 5, 1, 1, 2, 129, 731, 1268, 1923, 1281, 376, 55, 6
Offset: 0

Views

Author

Seiichi Manyama, Jan 27 2019

Keywords

Examples

			Square array begins:
   1,  1,   1,    1,     1,      1,       1, ...
   1,  1,   1,    1,     1,      1,       1, ...
   2,  2,   2,    2,     2,      2,       2, ...
   2,  3,   5,    9,    17,     33,      65, ...
   3,  5,  11,   29,    83,    245,     731, ...
   3,  8,  26,   92,   338,   1268,    4826, ...
   4, 13,  63,  343,  1923,  10903,   62283, ...
   4, 21, 153, 1281, 11553, 108801, 1050753, ...
		

Crossrefs

Columns 0-5 give A004526(n+2), A000045(n+1), A051286, A181545, A181546, A181547.
Main diagonal gives A323769.
Cf. A011973,

Programs

  • Mathematica
    f := Sum[Power[Binomial[#1 - i, i], #2], {i, 0, #1/2}] &;a = Flatten[Reverse[DeleteCases[Table[Table[f[m - n, n], {n, 0, 20}], {m, 0, 20}], 0, Infinity], 2]] (* Elijah Beregovsky, Nov 24 2020 *)

A259821 a(n) = floor( (3^n+1)^2/3^n ).

Original entry on oeis.org

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

Views

Author

Kival Ngaokrajang, Jul 07 2015

Keywords

Comments

a(n) is the curvature (rounded down) of circles inscribed between a unit circle and a circumscribed equilateral triangle. See illustration.
Apart from the first term the same as A168607. - R. J. Mathar, Jul 09 2015

Crossrefs

Programs

  • Mathematica
    Table[Floor[(3^n + 1)^2/3^n], {n, 0, 30}] (* Michael De Vlieger, Jul 07 2015 *)
    LinearRecurrence[{4,-3},{4,5,11},30] (* Harvey P. Dale, Sep 30 2024 *)
  • PARI
    a(n)=floor((3^n+1)^2/3^n)
    for (n=0, 100, print1(a(n),", "))
    
  • PARI
    Vec((3*x^2-11*x+4)/((x-1)*(3*x-1)) + O(x^100)) \\ Colin Barker, Jul 07 2015

Formula

a(n) = floor( A034472(n)^2/A000244(n) ).
From Colin Barker, Jul 07 2015: (Start)
a(n) = 3^n + 2 for n>0.
a(n) = 4*a(n-1) - 3*a(n-2) for n>2.
G.f.: (3*x^2-11*x+4) / ((x-1)*(3*x-1)).
(End)

A298940 a(n) is the smallest positive integer k such that 3^n - 2 divides 3^(n + k) + 2, or 0 if there is no such k.

Original entry on oeis.org

1, 3, 10, 39, 60, 121, 0, 117, 4920, 0, 0, 0, 28322, 0, 1434890, 0, 0, 0, 116226146, 0, 0, 15690529803, 0, 108443565, 66891206007, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22514195294549868, 0, 405255515301897626, 0, 1823649818858539320, 0, 0, 5861731560616733529, 0, 0, 0
Offset: 1

Views

Author

Luke W. Richards, Jan 29 2018

Keywords

Comments

3^n - 2 divides 3^(n + (2m + 1) * a(n)) + 2 for all nonnegative integers m.
a(n) is the least positive integer k, if any, such that 3^k == -1 (mod 3^n-2). If the order of 3 mod p is odd for some prime p dividing 3^n-2, a(n)=0. - Robert Israel, Feb 05 2018

Examples

			a(2) = 3 because 3^2 - 2 divides 3^5 + 2 and 3^2 - 2 does not divide any 3^x - 2 for 2 < x < 5.
a(5) = 60 because 3^5 - 2 divides 3^65 + 2 and 3^5 - 2 does not divide any 3^x - 2 for 5 < x < 65.
		

Crossrefs

Programs

  • Maple
    # This requires Maple 2016 or later
    f:= proc(n) local m,ps,a,p,q,phiq,v,br,ar;
      m:= 3^n-2;
       ps:= ifactors(m)[2];
       a:= 0;
       for p in ps do
         q:= p[1]^p[2];
         phiq:= (p[1]-1)*p[1]^(p[2]-1);
         v:= NumberTheory:-MultiplicativeOrder(3,q);
         if v::odd then return 0 fi;
         if p[2]=1 then br:= v/2
         else br:= traperror(NumberTheory:-ModularLog(-1,3,q));
              if br = lasterror then return 0 fi;
         fi;
         if a = 0 then a:= v; ar:= br
         else
            ar:= NumberTheory:-ChineseRemainder([ar,br],[a,v]);
            if ar = FAIL then return 0 fi;
            a:= ilcm(a, v);
         fi
       od:
       ar;
    end proc:
    f(1):= 1:
    map(f, [$1..50]); # Robert Israel, Feb 06 2018
  • Mathematica
    a[1] = 1; a[n_] := If[IntegerQ[order = MultiplicativeOrder[3, 3^n - 2, {-1}]], order, 0]; Table[an = a[n]; Print["a(", n, ") = ", an]; an, {n, 1, 20}] (* Jean-François Alcover, Feb 06 2018, after Robert Israel *)
  • PARI
    a(n) = if(n==1, return(1)); my(l = znlog(-1, Mod(3, 3^n - 2))); if(l == [], return(0), return(l)) \\ Iain Fox, Feb 06 2018
  • Python
    from sympy import discrete_log
    def A298940(n):
        if n == 1:
            return 1
        try:
            return discrete_log(3**n-2,-1,3)
        except ValueError:
            return 0 # Chai Wah Wu, Feb 05 2018
    

Extensions

Corrected by Robert Israel, Feb 05 2018
Showing 1-10 of 13 results. Next