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

A081614 Subsequence of A005428 with state = 1.

Original entry on oeis.org

1, 4, 6, 9, 31, 70, 105, 355, 799, 1798, 2697, 9103, 20482, 30723, 69127, 155536, 233304, 349956, 524934, 787401, 2657479, 5979328, 8968992, 13453488, 20180232, 30270348, 45405522, 68108283, 153243637, 1745540806, 2618311209, 8836800331, 19882800745, 67104452515, 150985018159, 339716290858, 509574436287, 1146542481646, 1719813722469, 13059835455001, 44076944660629, 753095921662471, 1694465823740560
Offset: 0

Views

Author

N. J. A. Sloane, Apr 23 2003

Keywords

Comments

Values of n such that A054995(n) = 1. - Ryan Brooks, Jul 17 2020
From Petros Hadjicostas, Jul 20 2020: (Start)
From a(1) = 4 to a(28) = 153243637, the values appear in Table 18 (p. 374) in Schuh (1968) under the Survivor No. 1 column (in a variation of Josephus's counting off game where m people on a circle are labeled 1 through m and every third person drops out).
a(29) here is 1745540806 but 1595540806 in Schuh (1968). Burde (1987) agrees with Schuh (1968). See the table on p. 207 of the paper (with q = 0). Actually, 1595540806 is the last number on the table with q = 0.
It seems Schuh (1968) made a calculation error and Burde (1987) copied it. See my comment for A073941 for more details. (End)

References

  • Fred Schuh, The Master Book of Mathematical Recreations, Dover, New York, 1968. [See Table 18, p. 374.]

Crossrefs

Programs

  • PARI
    /* In the program below, we use a truncated version of either A005428 or A073941 and choose those terms that correspond to "state" or "number of last survivor" equal to 1. See A073941 or Schuh (1968) for more details. */
    first(n) = {my(res = vector(n), t = 1, wn = wo = 4, go = gn = 1); res[1] = 1; for(i = 1, oo, c = wo % 2; if(go == 1, t++; res[t] = wo; if(t >= n, return(res) ) ); wn = floor(wo*3/2) + c * (2 - go); gn = 3 * c + go * (-1)^c; wo = wn; go = gn; ) } \\ David A. Corneth and Petros Hadjicostas, Jul 20 2020

Formula

a(n) = [(n+1)-th even number of A061419]/2. - John-Vincent Saddic, May 29 2021

Extensions

More terms from Hans Havermann, Apr 23 2003

A081615 Subsequence of A005428 where state = 2.

Original entry on oeis.org

1, 2, 3, 14, 21, 47, 158, 237, 533, 1199, 4046, 6069, 13655, 46085, 103691, 1181102, 1771653, 3986219, 102162425, 229865456, 344798184, 517197276, 775795914, 1163693871, 3927466814, 5891200221, 13255200497, 29824201118, 44736301677, 100656678773, 226477527239, 764361654431, 2579720583704, 3869580875556, 5804371313334, 8706556970001, 19589753182502, 29384629773753, 66115416990944, 99173125486416
Offset: 0

Views

Author

N. J. A. Sloane, Apr 23 2003

Keywords

Comments

Excluding the initial 1, the values of n such that A054995(n) = 2. - Ryan Brooks, Jul 17 2020
From Petros Hadjicostas, Jul 20 2020: (Start)
From a(1) = 2 to a(22) = 775795914, the values appear in Table 18 (p. 374) in Schuh (1968) under the Survivor No. 2 column (in a variation of Josephus's counting off game where m people on a circle are labeled 1 through m and every third person drops out).
a(23) here is 1163693871 but 1063693871 in Schuh (1968). Burde (1987) agrees with Schuh (1968). See the table on p. 207 of the paper (with q = 1).
It seems Schuh (1968) made a calculation error and Burde (1987) copied it. See my comment for A073941 for more details. (End)

References

  • Fred Schuh, The Master Book of Mathematical Recreations, Dover, New York, 1968. [See Table 18, p. 374.]

Crossrefs

Programs

  • PARI
    /* In the program below, we use a truncated version of either A005428 or A073941 and choose those terms that correspond to "state" or "number of last survivor" equal to 2. See A073941 or Schuh (1968) for more details. */
    first(n) = {my(res = vector(n), t = 1, wn = wo = gn = go = 2); res[1] = 1; for(i = 1, oo, c = wo % 2; if(go == 2, t++; res[t] = wo; if(t >= n, return(res))); wn = floor(wo*3/2) + c * (2 - go); gn = 3 * c + go * (-1)^c; wo = wn; go = gn; )} \\ David A. Corneth and Petros Hadjicostas, Jul 21 2020

Extensions

More terms from Hans Havermann, Apr 23 2003

A006257 Josephus problem: a(2*n) = 2*a(n)-1, a(2*n+1) = 2*a(n)+1.

Original entry on oeis.org

0, 1, 1, 3, 1, 3, 5, 7, 1, 3, 5, 7, 9, 11, 13, 15, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 41, 43, 45, 47, 49, 51, 53, 55, 57, 59, 61, 63, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 21, 23, 25, 27, 29
Offset: 0

Views

Author

Keywords

Comments

Write the numbers 1 through n in a circle, start at 1 and cross off every other number until only one number is left.
A version of the children's game "One potato, two potato, ...".
a(n)/A062383(n) = (0, 0.1, 0.01, 0.11, 0.001, ...) enumerates all binary fractions in the unit interval [0, 1). - Fredrik Johansson, Aug 14 2006
Iterating a(n), a(a(n)), ... eventually leads to 2^A000120(n) - 1. - Franklin T. Adams-Watters, Apr 09 2010
By inspection, the solution to the Josephus Problem is a sequence of odd numbers (from 1) starting at each power of 2. This yields a direct closed form expression (see formula below). - Gregory Pat Scandalis, Oct 15 2013
Also zero together with a triangle read by rows in which row n lists the first 2^(n-1) odd numbers (see A005408), n >= 1. Row lengths give A011782. Right border gives A000225. Row sums give A000302, n >= 1. See example. - Omar E. Pol, Oct 16 2013
For n > 0: a(n) = n + 1 - A080079(n). - Reinhard Zumkeller, Apr 14 2014
In binary, a(n) = ROL(n), where ROL = rotate left = remove the leftmost digit and append it to the right. For example, n = 41 = 101001_2 => a(n) = (0)10011_2 = 19. This also explains FTAW's comment above. - M. F. Hasler, Nov 02 2016
In the under-down Australian card deck separation: top card on bottom of a deck of n cards, next card separated on the table, etc., until one card is left. The position a(n), for n >= 1, from top will be the left over card. See, e.g., the Behrends reference, pp. 156-164. For the down-under case see 2*A053645(n), for n >= 3, n not a power of 2. If n >= 2 is a power of 2 the botton card survives. - Wolfdieter Lang, Jul 28 2020

Examples

			From _Omar E. Pol_, Jun 09 2009: (Start)
Written as an irregular triangle the sequence begins:
  0;
  1;
  1,3;
  1,3,5,7;
  1,3,5,7,9,11,13,15;
  1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31;
  1,3,5,7,9,11,13,15,17,19,21,23,25,27,29,31,33,35,37,39,41,
   43,45,47,49,51,53,55,57,59,61,63;
...
(End)
From _Omar E. Pol_, Nov 03 2018: (Start)
An illustration of initial terms, where a(n) is the area (or number of cells) in the n-th region of the structure:
   n   a(n)       Diagram
   0    0     _
   1    1    |_|_ _
   2    1      |_| |
   3    3      |_ _|_ _ _ _
   4    1          |_| | | |
   5    3          |_ _| | |
   6    5          |_ _ _| |
   7    7          |_ _ _ _|
(End)
		

References

  • Erhard Behrends, Der mathematische Zauberstab, Rowolth Taschenbuch Verlag, rororo 62902, 4. Auflage, 2019, pp. 156-164. [English version: The Math Behind the Magic, AMS, 2019.]
  • R. L. Graham, D. E. Knuth and O. Patashnik, Concrete Mathematics. Addison-Wesley, Reading, MA, 1990, p. 10.
  • M. S. Petković, "Josephus problem", Famous Puzzles of Great Mathematicians, page 179, Amer. Math. Soc. (AMS), 2009.
  • Michel Rigo, Formal Languages, Automata and Numeration Systems, 2 vols., Wiley, 2014. Mentions this sequence - see "List of Sequences" in Vol. 2.
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • Paul Weisenhorn, Josephus und seine Folgen, MNU, 59(2006), pp. 18-19.

Crossrefs

Second column, and main diagonal, of triangle A032434.
Cf. A181281 (with s=5), A054995 (with s=3).
Column k=2 of A360099.

Programs

  • Coq
    Require Import ZArith.
    Fixpoint a (n : positive) : Z :=
    match n with
    | xH => 1
    | xI n' => (2*(a n') + 1)%Z
    | xO n' => (2*(a n') - 1)%Z
    end.
    (* Stefan Haan, Aug 27 2023 *)
  • Haskell
    a006257 n = a006257_list !! n
    a006257_list =
       0 : 1 : (map (+ 1) $ zipWith mod (map (+ 1) $ tail a006257_list) [2..])
    -- Reinhard Zumkeller, Oct 06 2011
    
  • Magma
    [0] cat [2*(n-2^Floor(Log(2,n)))+1: n in [1..100]]; // Vincenzo Librandi, Jan 14 2016
    
  • Maple
    a(0):=0: for n from 1 to 100 do a(n):=(a(n-1)+1) mod n +1: end do:
    seq(a(i),i=0..100); # Paul Weisenhorn, Oct 10 2010; corrected by Robert Israel, Jan 13 2016
    A006257 := proc(n)
        convert(n,base,2) ;
        ListTools[Rotate](%,-1) ;
        add( op(i,%)*2^(i-1),i=1..nops(%)) ;
    end proc: # R. J. Mathar, May 20 2016
    A006257 := n -> 2*n  - Bits:-Iff(n, n):
    seq(A006257(n), n=0..78); # Peter Luschny, Sep 24 2019
  • Mathematica
    Table[ FromDigits[ RotateLeft[ IntegerDigits[n, 2]], 2], {n, 0, 80}] (* Robert G. Wilson v, Sep 21 2003 *)
    Flatten@Table[Range[1, 2^n - 1, 2], {n, 0, 5}] (* Birkas Gyorgy, Feb 07 2011 *)
    m = 5; Range[2^m - 1] + 1 - Flatten@Table[Reverse@Range[2^n], {n, 0, m - 1}] (* Birkas Gyorgy, Feb 07 2011 *)
  • PARI
    a(n)=sum(k=1,n,if(bitxor(n,k)Paul D. Hanna
    
  • PARI
    a(n)=if(n, 2*n-2^logint(2*n,2)+1, 0) \\ Charles R Greathouse IV, Oct 29 2016
    
  • Python
    import math
    def A006257(n):
         return 0 if n==0 else 2*(n-2**int(math.log(n,2)))+1 # Indranil Ghosh, Jan 11 2017
    
  • Python
    def A006257(n): return bool(n&(m:=1<Chai Wah Wu, Jan 22 2023
    (C#)
    static long cs_A006257(this long n) => n == 0 ? 0 : 1 + (1 + (n - 1).cs_A006257()) % n; // Frank Hollstein, Feb 24 2021
    

Formula

To get a(n), write n in binary, rotate left 1 place.
a(n) = 2*A053645(n) + 1 = 2(n-msb(n))+1. - Marc LeBrun, Jul 11 2001. [Here "msb" = "most significant bit", A053644.]
G.f.: 1 + 2/(1-x) * ((3*x-1)/(2-2*x) - Sum_{k>=1} 2^(k-1)*x^2^k). - Ralf Stephan, Apr 18 2003
a(n) = number of positive integers k < n such that n XOR k < n. a(n) = n - A035327(n). - Paul D. Hanna, Jan 21 2006
a(n) = n for n = 2^k - 1. - Zak Seidov, Dec 14 2006
a(n) = n - A035327(n). - K. Spage, Oct 22 2009
a(2^m+k) = 1+2*k; with 0 <= m and 0 <= k < 2^m; n = 2^m+k; m = floor(log_2(n)); k = n-2^m; a(n) = ((a(n-1)+1) mod n) + 1; a(1) = 1. E.g., n=27; m=4; k=11; a(27) = 1 + 2*11 = 23. - Paul Weisenhorn, Oct 10 2010
a(n) = 2*(n - 2^floor(log_2(n))) + 1 (see comment above). - Gregory Pat Scandalis, Oct 15 2013
a(n) = 0 if n = 0 and a(n) = 2*a(floor(n/2)) - (-1)^(n mod 2) if n > 0. - Marek A. Suchenek, Mar 31 2016
G.f. A(x) satisfies: A(x) = 2*A(x^2)*(1 + x) + x/(1 + x). - Ilya Gutkovskiy, Aug 31 2019
For n > 0: a(n) = 2 * A062050(n) - 1. - Frank Hollstein, Oct 25 2021

Extensions

More terms from Robert G. Wilson v, Sep 21 2003

A073941 a(n) = ceiling((Sum_{k=1..n-1} a(k)) / 2) for n >= 2 starting with a(1) = 1.

Original entry on oeis.org

1, 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
Offset: 1

Views

Author

Reinhard Zumkeller, Nov 20 2002

Keywords

Comments

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
From Petros Hadjicostas, Jul 20 2020: (Start)
We describe Schuh's counting-off game (pp. 373-375 and 377-379). Assume m people are standing on a circle and they are labeled 1 through m (say clockwise). We start with the person labeled 1 and every 3rd person drops out (in a variation of the famous Josephus problem). The process is repeated until only one person is left.
This sequence describes those numbers m for which either the person labeled 1 or the person labeled 2 is the last survivor.
From a(4) = 2 to a(53) = 775795914 (see T. D. Noe's b-file), the values agree with those in Schuh (1968, p. 374) and Burde (1987, p. 207). a(54) = 1163693871 while both Schuh and Burde have 1063693871 (a difference in the 2nd digit starting on the left). a(55) = 1745540806 while both Schuch and Burde have 1595540806.
Schuh (1968) obtains the numbers in the following way. Suppose we know a(n) and the corresponding number i(n) of the last survivor (i(n) = 1 or 2). We multiply a(n) by 3/2 (cf. Burde's use of fractional bases).
If the product is an integer, that is a(n+1) and the corresponding last survivor is the same.
If the product is not an integer, then a(n+1) = floor(a(n)*3/2) if the last survivor i(n) = 2 (and the new last survivor is i(n+1) = 1), and a(n+1) = ceiling(a(n)*3/2) if the last survivor is i(n) = 1 (and the new last survivor is i(n+1) = 2).
Note that a(53) = 775795914 and a(54) = (3/2)*a(53) = 1163693871 (not 1063693871), so it seems Schuh did a mistake and Burde copied it. Also (3/2)*1163693871 = 1745540806.5. Since a(53) = 775795914 corresponds to number 2, we round down, i.e., a(54) = 1745540806 (and move to number 1). If, however, we multiply the incorrect 1063693871 by 3/2 and round down, we get Schuh and Burde's incorrect value 1595540806 for a(54).
Numbers a(n) that correspond to last survivors being number 1 are tabulated in A081614 while numbers a(n) that correspond to last survivors being number 2 are tabulated in A081615. (End)
a(n) is the number of times (n-1) appears in A061420. - Chinmaya Dash, Aug 19 2020

References

  • Fred Schuh, The Master Book of Mathematical Recreations, Dover, New York, 1968. [See Table 18, p. 374. Only the terms from a(6) = 4 forward are shown in the table. The table is definitely related to this sequence.]

Crossrefs

Same as log_2(A082125(n)), for n > 2. - Ralf Stephan, Apr 16 2002
Apart from initial term, same as A005428, which has further information.
a(n+4) = A079719(n)+2. Cf. A082416.
Partial sums for various start indices are in A006999, A061419, A061418. - Ralf Stephan, Apr 17 2003
Is this the same as A081848/3?
The constant c is (2/9)*K(3) (see A083286). - Ralf Stephan, May 29 2003

Programs

  • Haskell
    a073941 n = a073941_list !! (n-1)
    a073941_list = 1 : f [1] where
       f xs = x' : f (x':xs) where x' = (1 + sum xs) `div` 2
    -- Reinhard Zumkeller, Oct 26 2011
    
  • Mathematica
    f[s_] := Append[s, Ceiling[Plus @@ s/2]]; Nest[f, {1}, 41] (* Robert G. Wilson v, Jul 07 2006 *)
  • PARI
    v=vector(100);s=v[1]=1;for(i=2,#v,s+=(v[i]=(s+1)\2));v \\ Charles R Greathouse IV, Feb 11 2011
    
  • Python
    from itertools import islice
    def A073941_gen(): # generator of terms
        a, c = 1, 0
        yield 1
        while True:
            yield (a:=(c:=c+a)+1>>1)
    A073941_list = list(islice(A073941_gen(),70)) # Chai Wah Wu, Sep 20 2022

Formula

a(n) = ceiling(c*(3/2)^n-1/2) where c = 0.3605045561966149591015446628665... - Benoit Cloitre, Nov 22 2002
If 2^m divides a(i) then 2^(m-1)*3^1 divides a(i+1) and so on... until finally, 3^m divides a(i+m). - Ralf Stephan, Apr 20 2003
a(n) = A081848(n)/3. - Tom Edgar, Jul 21 2014
a(n) = A005428(n-2). - Tanya Khovanova and PRIMES STEP Senior group, Jun 03 2018

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)

A024629 n written in fractional base 3/2.

Original entry on oeis.org

0, 1, 2, 20, 21, 22, 210, 211, 212, 2100, 2101, 2102, 2120, 2121, 2122, 21010, 21011, 21012, 21200, 21201, 21202, 21220, 21221, 21222, 210110, 210111, 210112, 212000, 212001, 212002, 212020, 212021, 212022, 212210, 212211, 212212, 2101100, 2101101
Offset: 0

Views

Author

Keywords

Comments

A246435(n) = (number of digits in a(n)) = A055642(a(n)). - Reinhard Zumkeller, Sep 05 2014
The number of positive even n such that a(n) has k+1 digits is A005428(k). - Glen Whitney, Jul 09 2017
The position of the rightmost "2" digit in a(3k), k >= 1, appears to be A087088(k). - Peter Munn, Jun 24 2020 [updated Peter Munn, Jul 14 2020 for new A087088 offset]

Examples

			Representations of the first few numbers are:
   0 =         0
   1 =         1
   2 =         2
   3 =       2 0
   4 =       2 1
   5 =       2 2
   6 =     2 1 0
   7 =     2 1 1
   8 =     2 1 2
   9 =   2 1 0 0
  10 =   2 1 0 1
  11 =   2 1 0 2
  12 =   2 1 2 0
  13 =   2 1 2 1
  14 =   2 1 2 2
  15 = 2 1 0 1 0
[extended and reformatted by _Peter Munn_, Jun 27 2020]
		

Crossrefs

Cf. A081848, A087088, A246435 (string lengths), A244040 (digit sums).

Programs

  • Haskell
    a024629 0 = 0
    a024629 n = 10 * a024629 (2 * n') + t where (n', t) = divMod n 3
    -- Reinhard Zumkeller, Sep 05 2014
  • Maple
    a:= proc(n) `if`(n<1, 0, irem(n, 3, 'q')+a(2*q)*10) end:
    seq(a(n), n=0..45);  # Alois P. Heinz, Jun 19 2018
  • Mathematica
    a[ n_] := If[ n < 1, 0, a[ Quotient[n, 3] 2] 10 + Mod[ n, 3]]; (* Michael Somos, Jun 18 2014 *)
  • PARI
    {a(n) = if( n<1, 0, a(n\3 * 2) * 10 + n%3)}; /* Michael Somos, Jun 18 2014 */
    
  • SageMath
    def basepqExpansion(p,q,n):
        L, i = [n], 1
        while L[i-1] >= p:
            x=L[i-1]
            L[i-1]=x.mod(p)
            L.append(q*(x//p))
            i+=1
        L.reverse()
        return Integer(''.join(str(x) for x in L))
    [basepqExpansion(3,2,n) for n in [0..40]] # Tom Edgar, Hailey R. Olafson, and James Van Alstine, Jun 17 2014; modified and corrected by G. C. Greubel, Aug 20 2019
    

Formula

To represent a number in base b, if a digit is >= b, subtract b and carry 1. In fractional base a/b, subtract a and carry b.
a(0)=0, a(3n+r) = 10*a(2n)+r for n >= 0 and r = 0, 1, 2. - Jianing Song, Oct 15 2022

Extensions

Tanton link corrected by Charles R Greathouse IV, Oct 20 2008

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

A006999 Partitioning integers to avoid arithmetic progressions of length 3.

Original entry on oeis.org

0, 1, 2, 4, 7, 11, 17, 26, 40, 61, 92, 139, 209, 314, 472, 709, 1064, 1597, 2396, 3595, 5393, 8090, 12136, 18205, 27308, 40963, 61445, 92168, 138253, 207380, 311071, 466607, 699911, 1049867, 1574801, 2362202, 3543304, 5314957, 7972436
Offset: 0

Views

Author

N. J. A. Sloane, D. R. Hofstadter, and James Propp, Jul 15 1977

Keywords

Comments

a(n) = A006997(3^n-1).
It appears that, aside from the first term, this is the (L)-sieve transform of A016789 ={2,5,8,11,...,3n+2....}. This has been verified up to a(30)=311071. See A152009 for the definition of the (L)-sieve transform. - John W. Layman, Nov 20 2008
a(n) is also the largest-index square reachable in n jumps if we start at square 0 of the Infinite Sidewalk. - Jose Villegas, Mar 27 2023

References

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

Crossrefs

Cf. A061419, A061418, A005428 (first differences), A083286.
Cf. A003312.

Programs

  • Haskell
    a006999 n = a006999_list !! n
    a006999_list = 0 : map ((`div` 2) . (+ 2) . (* 3)) a006999_list
    -- Reinhard Zumkeller, Oct 26 2011
  • Mathematica
    a[0] = 0; a[n_] := a[n] = Floor[(3 a[n-1] + 2)/2];
    Table[a[n], {n, 0, 40}] (* Jean-François Alcover, Aug 01 2018 *)
  • PARI
    a(n)=if(n<1,0,floor((3*a(n-1)+2)/2))
    

Formula

a(n) = A061419(n) - 1.
a(n) = A061418(n) - 2.
a(n) = floor((3a(n-1)+2)/2).
a(n) = -1 + floor(c*(3/2)^n) where c=1.0815136... - Benoit Cloitre, Jan 10 2002; this constant c is 2/3*K(3) (see A083286). - Ralf Stephan, May 29 2003
a(n+1) = (3*a(n))/2+1 if a(n) is even. a(n+1) = (3*a(n)+1)/2 if a(n) is odd. - Miquel Cerda, Jun 15 2019

Extensions

More terms from James Sellers, Feb 06 2000

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

A303500 The smallest positive even integer that can be written with n digits in base 3/2.

Original entry on oeis.org

2, 21, 210, 2101, 21011, 210110, 2101100, 21011000, 210110001, 2101100011, 21011000110, 210110001101, 2101100011010, 21011000110100, 210110001101001, 2101100011010011, 21011000110100110, 210110001101001101
Offset: 0

Views

Author

Tanya Khovanova and PRIMES STEP Senior group, May 09 2018

Keywords

Comments

a(n) is a prefix of a(n+1).
The smallest, not necessarily even, integer in base 3/2 with n digits is a(n-1) with 0 added at the end.

Examples

			The number 5 in base 3/2 is 22, and the number 6 is 210. Therefore, 210 is the smallest even integer with 3 digits in base 3/2.
		

Crossrefs

See A024629 for the base-3/2 expansion of n.

Programs

  • Maple
    roll32 := proc(L)
        local piv,L1 ;
        piv := 1;
        L1 := subsop(piv=op(piv,L)+1,L) ;
        while op(piv,L1) >= 3 do
            L1 := [seq(0,i=1..piv), op(piv+1,L1)+1, seq(op(i,L1),i=piv+2..nops(L1))] ;
            piv := piv+1 ;
        end do:
        L1 ;
    end proc:
    from32 := proc(L)
        add( op(i,L)*(3/2)^(i-1),i=1..nops(L)) ;
    end proc:
    A303500 := proc(n)
        local dgs ;
        dgs := [seq(0,i=1..n-1),1] ;
        while not type(from32(dgs),'even') do
            dgs := roll32(dgs) ;
        end do:
        dgs := ListTools[Reverse](dgs) ;
        digcatL(%) ;
    end proc: # R. J. Mathar, Jun 25 2018

Formula

a(n) = A024629(A305498(n)). - R. J. Mathar, Jun 25 2018
Showing 1-10 of 23 results. Next