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

A002491 Smallest number of stones in Tchoukaillon (or Mancala, or Kalahari) solitaire that make use of n-th hole.

Original entry on oeis.org

1, 2, 4, 6, 10, 12, 18, 22, 30, 34, 42, 48, 58, 60, 78, 82, 102, 108, 118, 132, 150, 154, 174, 192, 210, 214, 240, 258, 274, 282, 322, 330, 360, 372, 402, 418, 442, 454, 498, 510, 540, 570, 612, 622, 648, 672, 718, 732, 780, 802, 840, 870, 918
Offset: 1

Views

Author

Keywords

Comments

To get n-th term, start with n and successively round up to next multiple of n-1, n-2, ..., 1.
Generated by a sieve: start with [ 1..n ]; keep first number, drop every 2nd, keep first, drop every 3rd, keep first, drop every 4th, etc.
Comment from Don Knuth, Jun 08 2021, added by N. J. A. Sloane, Jun 09 2021: (Start)
I have put together a preliminary exposition of the results of Broline and Loeb (1995), in what's currently called Exercise 11 (on page 7) and its answer (on pages 9 and 10) of the Bipartite Matching document.
Unfortunately, I believe this paper erred when it claimed to have proved the conjecture of Erdős and Jabotinsky about the sharpness of approximation to n^2/pi. When they computed the sum of I_M in the proof of Theorem 9, they expressed it as f(M-1)^2/4M + O(f(M-1)). That's correct; but the error gets quite large, and when summed gives O(n^(3/2)), not O(n).
By summing over only part of the range, and using another estimate in the rest, I believe one can get an overall error bound O(n^(4/3)), thus matching the result of Erdős and Jabotinsky but not improving on it. (End)

Examples

			To get 10th term: 10->18->24->28->30->30->32->33->34->34.
		

References

  • Y. David, On a sequence generated by a sieving process, Riveon Lematematika, 11 (1957), 26-31.
  • S. R. Finch, Mathematical Constants, Cambridge, 2003, Section 1.4.7.
  • V. Gautheron, Chapter 3.II.5: La Tchouka, in Wari et Solo: le Jeu de calculs africain (Les Distracts), Edited by A. Deledicq and A. Popova, CEDIC, Paris, 1977, 180-187.
  • D. E. Knuth, Bipartite Matching, The Art of Computer Programming, Vol. 4, Pre-fascicle 14A, June 8, 2021, http://cs.stanford.edu/~knuth/fasc14a.ps.gz. See Sect. 7.5.1, Exercise 11.
  • N. J. A. Sloane, A Handbook of Integer Sequences, Academic Press, 1973 (includes this sequence).
  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).

Crossrefs

Programs

  • Haskell
    a002491 n = a002491_list !! (n-1)
    a002491_list = sieve 1 [1..] where
       sieve k (x:xs) = x : sieve (k+1) (mancala xs) where
          mancala xs = us ++ mancala vs where (us,v:vs) = splitAt k xs
    -- Reinhard Zumkeller, Oct 31 2012
    
  • Maple
    # A002491
    # program due to B. Gourevitch
    a := proc(n)
    local x,f,i,y;
      x := n; f := n;
      for i from x by -1 to 2 do
         y := i-1;
         while y < f do
           y := y+i-1
         od;
      f := y
      od
    end:
    seq(a(n), n = 2 .. 53);
  • Mathematica
    f[n_] := Fold[ #2*Ceiling[ #1/#2 + 0] &, n, Reverse@Range[n - 1]]; Array[f, 56] (* Robert G. Wilson v, Nov 05 2005 *)
    del[list_, k_] := Delete[list, Table[{i}, {i, k, Length[list], k}]]; a[n_] := Last@NestWhile[{#[[1]] + 1, del[Rest@#[[2]], #[[1]] + 1], Append[#[[3]], First@#[[2]]]} &, {1,Range[n], {}}, #[[2]] =!= {} &]; a[1000] (* Birkas Gyorgy, Feb 26 2011 *)
    Table[1 + First@FixedPoint[{Floor[#[[1]]*(#[[2]] + 1/2)/#[[2]]], #[[2]] + 1} &, {n, 1}, SameTest -> (#1[[1]] == #2[[1]] &)], {n, 0, 30}] (* Birkas Gyorgy, Mar 07 2011 *)
    f[n_]:=Block[{x,p},For[x=p=1, p<=n, p++, x=Ceiling[(n+2-p)x/(n+1-p)]];x] (* Don Knuth, May 27 2021 *)
  • PARI
    a(n)=forstep(k=n-1,2,-1, n=((n-1)\k+1)*k); n \\ Charles R Greathouse IV, Mar 29 2016

Formula

Equals A007952(n) + 1 or equally A108696(n) - 1.
A130747(a(n)) = 1. - Reinhard Zumkeller, Jun 23 2009
a(n+1) = 1 + [..[[[[n*3/2]5/4]7/6]9/8]...(2k+1)/2k]...]. - Birkas Gyorgy, Mar 07 2011
Limit_{n -> oo} n^2/a(n) = Pi (see Brown). - Peter Bala, Mar 12 2014
It appears that a(n)/2 = A104738(n-1). - Don Knuth, May 27 2021

A007952 Generated by a sieve: keep first number, drop every 2nd, keep first, drop every 3rd, keep first, drop every 4th, etc.

Original entry on oeis.org

0, 1, 3, 5, 9, 11, 17, 21, 29, 33, 41, 47, 57, 59, 77, 81, 101, 107, 117, 131, 149, 153, 173, 191, 209, 213, 239, 257, 273, 281, 321, 329, 359, 371, 401, 417, 441, 453, 497, 509, 539, 569, 611, 621, 647, 671, 717, 731, 779, 801, 839, 869, 917, 929, 989, 1001, 1053, 1067
Offset: 0

Views

Author

N. J. A. Sloane, R. Muller

Keywords

Comments

Also called the sieve of Tchoukaillon (or Mancala, or Kalahari).
If k+1 occurs at rank i for the first time, then i is given by the program: i = 0: for j = k to 1 step -1: i = 1 + i + int ( i / j ): next: - Claude Lenormand (claude.lenormand(AT)free.fr), Jan 15 2001
A082447(n+1) = (number of terms <= n); see A141262 for primes. - Reinhard Zumkeller, Jun 21 2008

References

  • Y. David, On a sequence generated by a sieving process, Riveon Lematematika, 11 (1957), 26-31.
  • M. Le, On the Smarandache n-ary Sieve, Smarandache Notions Journal, Vol. 10, No. 1-2-3, 1999, 146-147.

Crossrefs

Programs

  • Haskell
    a007952 n = a007952_list !! n
    a007952_list = f 1 [0..] where
       f k (x:xs) = x : f (k + 1) (g xs) where
         g ws = us ++ (g vs) where (us, _:vs) = splitAt k ws
    -- Reinhard Zumkeller, Jan 19 2014
    
  • Mathematica
    f[n_] := Fold[#2*Floor[#1/#2 + 1] &, n, Reverse@ Range[n - 1]]; Array[f, 55] (* From David Wilson *)
  • PARI
    a(n) = my(ret=0); forstep(k=n,1,-1, ret++; ret+=(-ret)%k); ret; \\ Kevin Ryde, Sep 30 2022

Formula

Equals A002491(n) - 1. Equals A108696 - 2.

Extensions

Corrected and extended by David W. Wilson

A028920 Pit harvesting sequence for winning solitaire Tchoukaillon (or Mancala).

Original entry on oeis.org

1, 2, 1, 3, 1, 4, 1, 2, 1, 5, 1, 6, 1, 2, 1, 3, 1, 7, 1, 2, 1, 8, 1, 4, 1, 2, 1, 3, 1, 9, 1, 2, 1, 10, 1, 5, 1, 2, 1, 3, 1, 11, 1, 2, 1, 4, 1, 12, 1, 2, 1, 3, 1, 6, 1, 2, 1, 13, 1, 14, 1, 2, 1, 3, 1, 4, 1, 2, 1, 5, 1, 7, 1, 2, 1, 3, 1, 15, 1, 2, 1, 16, 1, 4, 1, 2, 1, 3, 1, 8, 1, 2, 1, 6, 1, 5, 1, 2, 1, 3, 1, 17, 1
Offset: 0

Views

Author

Keywords

Comments

From Benoit Cloitre, Mar 09 2007: (Start)
The sequence can be constructed as follows using parentheses (NP means "term not in parentheses"):
Start from the positive integers:
1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,...
Step 1: put the least NP "1" in parentheses and every 2 terms giving:
(1),2,(3),4,(5),6,(7),8,(9),10,(11),12,(13),14,(15),16,(17),18,(19),...
Step 2: put the least NP "2" in 2 parentheses and every 3 NP giving:
(1),((2)),(3),4,(5),6,(7),((8)),(9),10,(11),12,(13),((14)),(15),16,(17),...
so that between 2 consecutives ((x)) there are 2 NP.
Step 3: put the least NP "4" in 3 parentheses and every 4 NP giving:
(1),((2)),(3),(((4))),(5),6,(7),((8)),(9),10,(11),12,(13),((14)),(15),(((16))),...
so that between 2 consecutives (((x))) there are 3 NP.
Step 4: put the least NP "6" in 4 parentheses and every 5 NP giving:
(1),((2)),(3),(((4))),(5),((((6)))),(7),((8)),(9),10,(11),12,(13),((14)),(15),(((16))),...
so that between 2 consecutives ((((x)))) there are 4 NP.
Iterating the process indefinitely yields:
(1),((2)),(3),(((4))),(5),((((6)))),(7),((8)),(9),(((((10))))),(11),...
Count the parentheses:
1,2,1,3,1,4,1,2,1,5,1,... - this is the sequence.
(End)
From Benoit Cloitre, Jul 26 2007: (Start)
A simpler way to construct the sequence: start from
1,,1,,1,,1,,1,,1,,1,_,1,... where 1's are spaced by one hole;
fill first hole with 2 and leave 2 holes between two 2's giving
1,2,1,,1,,1,2,1,,1,,1,2,1,...;
fill new first hole with 3 and leave 3 holes between two 3's giving
1,2,1,3,1,,1,2,1,,1,_,1,2,1,3...;
iterating the process indefinitely yields the sequence.
(End)
Ordinal transform of A130747. - Benoit Cloitre, Aug 03 2007
Although this sequence and A130747 are not fractal sequences (according to Kimberling's definition), we say they are "mutual fractal sequences" since the ordinal transform of one gives the other. - Benoit Cloitre, Aug 03 2007
The smallest n with a(n) = k is circa k^2/Pi.
The element n >= 0 occurs in this sequence with limiting density 1/(n*(n+1)).

Crossrefs

Programs

  • Mathematica
    n = 15; Fold[If[Length@Position[#1, 0] > 0, ReplacePart[#1,First /@ Partition[Position[#1, 0], #2 + 1, #2 + 1, {1, 1}] -> #2], #1] &,  Flatten@Array[{1, 0} &, n], Range[2, 2 n]] (* Birkas Gyorgy, Feb 26 2011 *)
  • PARI
    a(n) = {ok = 0; m = 1; while (!ok, if ((n%(m+1) == 0), ok = 1, n = n*m\(m+1); m++);); m;} \\ Michel Marcus, Dec 06 2015

Formula

a(2n+1) = 1 + A104706(n+1), a(2n) = 1. - Benoit Cloitre, Mar 09 2007
The sieve of A007952 processes n in the a(n)-th pass. a(A007952(n)) = n+1.

Extensions

Additional comments from David W. Wilson, Feb 25 2010

A028933 Table of winning positions in Tchoukaillon (or Mancala) solitaire.

Original entry on oeis.org

0, 1, 0, 2, 1, 2, 0, 1, 3, 1, 1, 3, 0, 0, 2, 4, 1, 0, 2, 4, 0, 2, 2, 4, 1, 2, 2, 4, 0, 1, 1, 3, 5, 1, 1, 1, 3, 5, 0, 0, 0, 2, 4, 6, 1, 0, 0, 2, 4, 6, 0, 2, 0, 2, 4, 6, 1, 2, 0, 2, 4, 6, 0, 1, 3, 2, 4, 6, 1, 1, 3, 2, 4, 6, 0, 0, 2, 1, 3, 5, 7, 1, 0, 2, 1, 3, 5, 7
Offset: 0

Views

Author

Keywords

Comments

Table read by rows where b(n,i) = the number of counters in the i-th position from the store of the unique winning Tchoukaillon board having n total counters.

Examples

			   The rows of b(n,i) begin
   n\i 1 2 3 4 5 6
   1   1
   2   0 2
   3   1 2
   4   0 1 3
   5   1 1 3
   6   0 0 2 4
   7   1 0 2 4
   8   0 2 2 4
   9   1 2 2 4
   10  0 1 1 3 5
   11  1 1 1 3 5
   12  0 0 0 2 4 6
   13  1 0 0 2 4 6
   14  0 2 0 2 4 6
   15  1 2 0 2 4 6
   16  0 1 3 2 4 6
   17  1 1 3 2 4 6
		

Crossrefs

Programs

  • Mathematica
    s[list_] := Module[{x = Append[list, 0], i = 1}, While[x[[i]] =!= 0, x[[i]] = x[[i]] - 1; i = i + 1]; x[[i]] = i; If[Last@x == 0, Most[x], x]]; Prepend[Flatten@NestList[s, {}, 20],0] (* Birkas Gyorgy, Feb 26 2011 *)

Formula

Let p(n) be the minimum j such that b(n,j) = 0. (This is A028920.)
Directly from the rules of Tchoukaillon, we find b(n+1,i) = (b(n,i) - 1 for 1 <= i < p(n), i for i = p(n), and b(n,i) for i > p(n)).
Also, b(n,i) = (n - Sum_{j=1..(i-1)} b(n,j)) mod (i+1).

Extensions

Formulas added by Brant Jones, Oct 14 2013

A028931 Strings giving winning positions in Tchoukaillon (or Mancala) solitaire.

Original entry on oeis.org

0, 1, 20, 21, 310, 311, 4200, 4201, 4220, 4221, 53110, 53111, 642000, 642001, 642020, 642021, 642310, 642311, 7531200, 7531201, 7531220, 7531221, 86420110, 86420111, 86424000, 86424001, 86424020, 86424021, 86424310, 86424311
Offset: 0

Views

Author

Keywords

Comments

a(n) gives string listing winning position for n stones.
Sum of numbers in a(n) is equal to n.
Using the chromatic (tet-12) scale, (if C=0, 12, 24...) all integers correspond to pitches C, C#, G#, A, Bb, B, a recursive pattern that evenly bisects the octave and avoids the tritone (IC6). - Nik Bizzell-Browning, Apr 27 2019

Examples

			For example, a(10) = 53111; rightmost 0 is in position 6, so get 653111 -> a(11) = 642000.
		

Crossrefs

Programs

  • Mathematica
    a[1] = {0};a[n_]:=a[n]=Module[{gs=a[n-1],len=Length[a[n-1]],pos},If[FreeQ[gs,0],Prepend[gs-1,1+len],pos=FirstPosition[Reverse[gs],0][[1]];(gs[[;;len-pos]])~Join~{pos}~Join~If[pos==1,{},(gs[[len-pos+2;;]]-1)]]];StringJoin/@Map[ToString, Array[a, 30], {2}] (* Shenghui Yang, Jun 06 2025 *)

Formula

To get the next term, if rightmost 0 is in position i, replace it by i and subtract 1 from all earlier entries.

Extensions

More terms from Erich Friedman
Showing 1-5 of 5 results.