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

A072493 a(1) = 1 and a(n) = ceiling((Sum_{k=1..n-1} a(k))/3) for n >= 2.

Original entry on oeis.org

1, 1, 1, 1, 2, 2, 3, 4, 5, 7, 9, 12, 16, 22, 29, 39, 52, 69, 92, 123, 164, 218, 291, 388, 517, 690, 920, 1226, 1635, 2180, 2907, 3876, 5168, 6890, 9187, 12249, 16332, 21776, 29035, 38713, 51618, 68824, 91765, 122353, 163138, 217517, 290023, 386697
Offset: 1

Views

Author

Benoit Cloitre, Nov 22 2002

Keywords

Comments

Is this sequence, with its first 8 terms removed, the same as A005427? See also the similar conjecture with A005428/A073941. - Ralf Stephan, Apr 04 2003
Yes; the first 8 terms sum to 15, so upon dividing by 3 they are equivalent to the +5 in the formula for A005427. - Charlie Neder, Jan 10 2019
From Petros Hadjicostas, Jul 21 2020: (Start)
Conjecture 1: a(n) equals the number of multiples of 3 whose representation in base 4/3 (see A024631) has n-1 digits. For example, a(8) = 4 because there are four multiples of 3 with n-1 = 7 digits in their representation in base 4/3: 33 = 3210201, 36 = 3210230, 39 = 3210233, and 42 = 3213122.
Conjecture 2: a(n) equals 1/4 times the number of nonnegative integers with the property that their 4/3-expansion has n digits (assuming that the 4/3-expansion of 0 has 1 digit). For example, a(7)*4 = 12 because the following 12 numbers have 4/3 expansions with n = 7 digits: 32 = 3210200, 33 = 3210201, 34 = 3210202, ..., 42 = 3213122, 43 = 3213123. (End)

Crossrefs

Programs

  • Mathematica
    f[s_] := Append[s, Ceiling[Plus @@ s/3]]; Nest[f, {1}, 52] (* Robert G. Wilson v, Jul 07 2006 *)
  • PARI
    lista(nn) = {va = vector(nn); va[1] = 1; for (n=2, nn, va[n] = ceil(sum(k=1, n-1, va[k])/3);); va;} \\ Michel Marcus, Apr 16 2015

Formula

a(n) = ceiling(c*(4/3)^n - 1/2) where c = 0.389324199524937508840138455...
From Petros Hadjicostas, Jul 21 2020: (Start)
Conjecture: The constant c above equals (3/16)*K(4), where K(q) = C(q/(q-1)) (q > 1) is described in Odlyzko and Wilf (1991).
For a > 1, the constant C(a) = limit_{n -> infinity} f_n(a)/a^n, where f_{n+1}(a) = ceiling(a*f_n(a)) for n >= 0 and f_0(a) = 1.
Thus, K(4) = limit_{n -> infinity} f_n(4/3)/(4/3)^n = 2.076395730799666... We have K(2) = 1 and K(3) = A083286 = 1.622270502884767315... (End)

A005428 a(n) = ceiling((1 + sum of preceding terms) / 2) starting with a(0) = 1.

Original entry on oeis.org

1, 1, 2, 3, 4, 6, 9, 14, 21, 31, 47, 70, 105, 158, 237, 355, 533, 799, 1199, 1798, 2697, 4046, 6069, 9103, 13655, 20482, 30723, 46085, 69127, 103691, 155536, 233304, 349956, 524934, 787401, 1181102, 1771653, 2657479, 3986219, 5979328, 8968992, 13453488, 20180232, 30270348, 45405522, 68108283, 102162425, 153243637, 229865456, 344798184
Offset: 0

Views

Author

Keywords

Comments

Original definition: a(0) = 1, state(0) = 2; for n >= 1, if a(n-1) is even then a(n) = 3*a(n-1)/2 and state(n) = state(n-1); if a(n-1) is odd and state(n-1) = 1 then a(n) = ceiling( 3*a(n-1)/2) and state(n) = 3 - state(n-1) and if a(n-1) is odd and state(n-1) = 2 then a(n) = floor( 3*a(n-1)/2) and state(n) = 3 - state(n-1). [See formula by M. Alekseyev for a simpler equivalent. - Ed.]
Arises from a version of the Josephus problem: sequence gives set of n where, if you start with n people and every 3rd person drops out, either it is person #1 or #2 who is left at the end. A081614 and A081615 give the subsequences where it is person #1 (respectively #2) who is left.
The state changes just when a(n) is odd: it therefore indicates whether the sum of a(0) to a(n) is odd (1 means no, 2 means yes).
The sum a(0) to a(n) is never divisible by 3 (for n >= 0); it is 1 mod 3 precisely when the sum a(0) to a(n-1) is odd and thus indicates the state at the previous step. - Franklin T. Adams-Watters, May 14 2008
The number of nodes at level n of a planted binary tree with alternating branching and non-branching nodes. - Joseph P. Shoulak, Aug 26 2012
Take Sum_{k=1..n} a(k) objects, and partition them into 3 parts. It is always possible to generate those parts using addends once each from the initial n terms, and this is the fastest growing sequence with this property. For example, taking 1+1+2+3+4+6+9 = 26 objects, if we partition them [10,9,7], we can generate these sizes as 10 = 9+1, 9 = 6+3, 7 = 4+2+1. The corresponding sequence partitioning into 2 parts is the powers of 2, A000079. In general, to handle partitioning into k parts, replace the division by 2 in the definition with division by k-1. - Franklin T. Adams-Watters, Nov 07 2015
a(n) is the number of even integers that have n+1 digits when written in base 3/2. For example, there are 2 even integers that use three digits in base 3/2: 6 and 8: they are written as 210 and 212, respectively. - Tanya Khovanova and PRIMES STEP Senior group, Jun 03 2018

Examples

			n........0...1...2...3...4...5...6...7...8...9..10..11..12..13..14.
state=1......1...........4...6...9..........31.....70..105.........
state=2..1.......2...3..............14..21......47.........158..237
		

References

  • F. Schuh, The Master Book of Mathematical Recreations. Dover, NY, 1968, page, 374, Table 18, union of columns 1 and 2 (which are A081614 and A081615).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Cf. A005427, A073941, A082416. Union of A081614 and A081615.
First differences of D_3(n) (A061419) in the terminology of Odlyzko and Wilf. - Ralf Stephan, Apr 23 2002
Same as log_2(A082125(n+3)). - Ralf Stephan, Apr 16 2002
Apart from initial terms, same as A073941, which has further information.
a(n) is the number of positive even k for which A024629(k) has n+1 digits. - Glen Whitney, Jul 09 2017
Partial sums are in A061419, A061418, A006999.

Programs

  • Haskell
    a005428 n = a005428_list !! n
    a005428_list = (iterate j (1, 1)) where
       j (a, s) = (a', (s + a') `mod` 2) where
         a' = (3 * a + (1 - s) * a `mod` 2) `div` 2
    -- Reinhard Zumkeller, May 10 2015 (fixed), Oct 26 2011
    
  • Mathematica
    f[s_] := Append[s, Ceiling[(1 + Plus @@ s)/2]]; Nest[f, {1}, 40] (* Robert G. Wilson v, Jul 07 2006 *)
    nxt[{t_,a_}]:=Module[{c=Ceiling[(1+t)/2]},{t+c,c}]; NestList[nxt,{1,1},50][[All,2]] (* Harvey P. Dale, Nov 05 2017 *)
  • PARI
    { a=1; s=2; for(k=1,50, print1(a,", "); a=(3*a+s-1)\2; s=(s+a)%3; ) } \\ Max Alekseyev, Mar 28 2009
    
  • PARI
    s=0;vector(50,n,-s+s+=s\2+1)  \\ M. F. Hasler, Oct 14 2012
    
  • Python
    from itertools import islice
    def A005428_gen(): # generator of terms
        a, c = 1, 0
        yield 1
        while True:
            yield (a:=1+((c:=c+a)>>1))
    A005428_list = list(islice(A005428_gen(),30)) # Chai Wah Wu, Sep 21 2022

Formula

a(0) = 1; a(n) = ceiling((1 + Sum_{k=0..n-1} a(k)) / 2). - Don Reble, Apr 23 2003
a(1) = 1, s(1) = 2, and for n > 1, a(n) = floor((3*a(n-1) + s(n-1) - 1) / 2), s(n) = (s(n-1) + a(n)) mod 3. - Max Alekseyev, Mar 28 2009
a(n) = floor(1 + (sum of preceding terms)/2). - M. F. Hasler, Oct 14 2012

Extensions

More terms from Hans Havermann, Apr 23 2003
Definition replaced with a simpler formula due to Don Reble, by M. F. Hasler, Oct 14 2012

A054995 A version of Josephus problem: a(n) is the surviving integer under the following elimination process. Arrange 1,2,3,...,n in a circle, increasing clockwise. Starting with i=1, delete the integer two places clockwise from i. Repeat, counting two places from the next undeleted integer, until only one integer remains.

Original entry on oeis.org

1, 2, 2, 1, 4, 1, 4, 7, 1, 4, 7, 10, 13, 2, 5, 8, 11, 14, 17, 20, 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 1, 4, 7, 10, 13, 16, 19, 22, 25, 28, 31, 34, 37, 40, 43, 46, 2, 5, 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38, 41, 44, 47, 50, 53, 56, 59, 62, 65, 68, 1, 4, 7, 10, 13, 16, 19, 22, 25
Offset: 1

Views

Author

John W. Layman, May 30 2000

Keywords

Comments

If one counts only one place (rather than two) at each stage to determine the element to be deleted, the Josephus survivors (A006257) are obtained.

Examples

			a(5) = 4 because the elimination process gives (1^,2,3,4,5) -> (1,2,4^,5) -> (2^,4,5) -> (2^,4) -> (4), where ^ denotes the counting reference position.
a(13) = 13 => a(14) = (a(13) + 2) mod 14 + 1 = 2. - _Paul Weisenhorn_, Oct 10 2010
		

Crossrefs

Cf. A181281 (with s=5). - Paul Weisenhorn, Oct 10 2010

Programs

  • Mathematica
    (* First do *) Needs["Combinatorica`"] (* then *) f[n_] := Last@ InversePermutation@ Josephus[n, 3]; Array[f, 70] (* Robert G. Wilson v, Jul 31 2010 *)
    Table[Nest[Rest@RotateLeft[#, 2] &, Range[n], n - 1], {n, 72}] // Flatten (* Arkadiusz Wesolowski, Jan 14 2013 *)

Formula

a(n) = 3*n + 1 - floor(K(3)*(3/2)^(ceiling(log((2*n+1)/K(3))/log(3/2)))) where K(3) = (3/2)*K = 1.622270502884767... (K is the constant described in A061419); a(n) = 3n + 1 - A061419(k+1) where A061419(k+1) is the least integer such that A061419(k+1) > 2n.
a(1) = 1 and, for n > 1, a(n) = (a(n-1) + 3) mod n, if this value is nonzero, n otherwise.
a(n) = (a(n-1) + 2) mod n + 1. - Paul Weisenhorn, Oct 10 2010

A088333 A version of Josephus problem: a(n) is the surviving integer under the following elimination process. Arrange 1,2,3,...,n in a circle, increasing clockwise. Starting with i=1, delete the integer 3 places clockwise from i. Repeat, counting 3 places from the next undeleted integer, until only one integer remains.

Original entry on oeis.org

1, 1, 2, 2, 1, 5, 2, 6, 1, 5, 9, 1, 5, 9, 13, 1, 5, 9, 13, 17, 21, 3, 7, 11, 15, 19, 23, 27, 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 3, 7, 11, 15, 19, 23, 27, 31, 35, 39, 43, 47, 51, 55, 59, 63, 67, 2, 6, 10, 14, 18, 22, 26, 30, 34, 38, 42
Offset: 1

Views

Author

N. J. A. Sloane, Nov 13 2003

Keywords

Comments

If one counts only one place (resp. two places) at each stage to determine the element to be deleted, we get A006257 (resp. A054995).

References

  • See A054995 for references and links.

Crossrefs

Formula

It is tempting (in view of A054995) to conjecture that a(1)=1 and, for n>1, a(n) = (a(n-1)+4) mod n. The conjecture is false; counterexample: a(21)=21; a(20)=17; (a(20)+4)mod 21=0; corrected formula: a(n)=(a(n-1)+3) mod n +1;
The conjecture is true. After removing the 4th number, we are reduced to the n-1 case, but starting with 5 instead of 1. - David Wasserman, Aug 08 2005
a(n) = A032434(n,4) if n>=4. - R. J. Mathar, May 04 2007

Extensions

More terms from David Wasserman, Aug 08 2005

A178853 "Josephus problem": n persons stand in a circle and eliminate every seventh person counting clockwise until only person a(n) is remaining.

Original entry on oeis.org

1, 2, 3, 2, 4, 5, 5, 4, 2, 9, 5, 12, 6, 13, 5, 12, 2, 9, 16, 3, 10, 17, 1, 8, 15, 22, 2, 9, 16, 23, 30, 5, 12, 19, 26, 33, 3, 10, 17, 24, 31, 38, 2, 9, 16, 23, 30, 37, 44, 1, 8, 15, 22, 29, 36, 43, 50, 57, 5, 12, 19, 26, 33, 40, 47, 54, 61, 68, 6, 13, 20, 27, 34, 41, 48, 55, 62, 69, 76
Offset: 1

Views

Author

Roland Schroeder (florola(AT)gmx.de), Jun 18 2010

Keywords

Comments

Several other versions of this sequence are already in the OEIS. - N. J. A. Sloane, Jun 24 2010

Crossrefs

Programs

  • Mathematica
    Needs["Combinatorica`"]
    a[n_] := Last@ InversePermutation@ Josephus[n, 7]; Array[a, 79] (* Robert G. Wilson v, Jul 31 2010 *)

Extensions

a(29) onwards from Robert G. Wilson v, Jul 31 2010

A348533 Generalized Josephus problem: Let T(m,k), k>=2, m=1,2,3,.., be the number of people on a circle such that the survivor is one of the first k-1 people after every k-th person has been removed.

Original entry on oeis.org

1, 2, 1, 4, 2, 1, 8, 3, 2, 1, 16, 4, 3, 2, 1, 32, 6, 4, 3, 2, 1, 64, 9, 5, 4, 3, 2, 1, 128, 14, 7, 5, 4, 3, 2, 1, 256, 21, 9, 6, 5, 4, 3, 2, 1, 512, 31, 12, 8, 6, 5, 4, 3, 2, 1, 1024, 47, 16, 10, 7, 6, 5, 4, 3, 2, 1, 2048, 70, 22, 12, 8, 7, 6, 5, 4, 3, 2, 1
Offset: 1

Views

Author

Gerhard Kirchner, Oct 21 2021

Keywords

Comments

The table, see example, is read by ascending antidiagonals.
Trivial cases: T(m,k)=m for m
The recurrence in the formula section does not only yield T(m,k), but also the survivor's number S(m,k) so that the Josephus problem can be solved for any number N of people, especially for large N because T(m,k) grows exponentially, see link "Derivation of the recurrence", section II.
T(m,k) compared with other sequences ("->" means that the sequences can be made equal by removing repeated terms, see link "Derivation of the recurrence", section IV).
T(m,2) = A000079(m)=2^(m-1)
T(m,3) -> A073941
T(m,4) -> A072493
T(m+4,4)= A005427(m)
T(m,5) -> A120160
T(m,6) -> A120170
T(m,7) -> A120178
T(m,8) -> A120186
T(m,9) -> A120194
T(m,10)-> A120202

Examples

			k=4: 7 people, survivors number 2 <4.
k=4: 6 people, survivors number 5>=4, counterexample.
Table T(m,k) begins:
  m\k____2____3____4____5
   1:    1    1    1    1
   2:    2    2    2    2
   3:    4    3    3    3
   4:    8    4    4    4
   5:   16    6    5    5
   6:   32    9    7    6
   7:   64   14    9    8
   8:  128   21   12   10
   9:  256   31   16   12
  10:  512   47   22   15
		

Crossrefs

Programs

  • Maxima
    block(k:10, mmax:30, t:1, s:1, T:[1],
    /*Terms T(m,k), m=1 thru mmax */
    for m from 1 thru mmax-1 do(
        p:  mod(t, k-1),
        if s>p then e:-p else e:k-1-p,
        t: (k*t+e)/(k-1), s: 1+mod(s+e-1, t),
        T:append(T,[t])),
    return (T));

Formula

Recurrence for T(m,k) and S(m,k), the survivor's number.
Start: T(1,k)=S(1,k)=1.
T(m+1,k)=(k*T(m,k)+e)/(k-1),
S(m+1,k)=1 + (S(m,k)+e-1) mod T(m+1,k),
with e=-p if S(m,k)>p and e=k-1-p otherwise, p = T(m,k) mod (k-1).
Showing 1-6 of 6 results.