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-3 of 3 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

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

A082447 a(n) = the number k such that s(k)=0 where s(0)=n and s(i)=s(i-1)-(s(i-1) modulo (i+1)).

Original entry on oeis.org

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

Views

Author

Benoit Cloitre, Apr 25 2003

Keywords

Comments

a(n+1) = number of Mancala numbers <= n, see A007952; n occurs A028913(n-1) times consecutively. - Reinhard Zumkeller, Jun 21 2008
a(n) = number of ones <= n in A130747; see also A002491. - Reinhard Zumkeller, Jul 01 2009

Examples

			For n=4, s(0)=4, 4 ->4-4 mod 1=4 ->4-4 mod 2=4 ->4-4 mod 3=3 ->3-3 mod 4=0, hence s(4)=0 and a(4)=4.
For n=6, s(0)=6, s(1)=6-6 mod 2=6, s(2)=6-6 mod 3=6, s(3)=6-6 mod 4=6-2=4, s(4)=4-4 mod 5=0, hence a(6)=4.
		

Crossrefs

Programs

  • Mathematica
    Flatten@Table[First@Position[Rest@FoldList[#1-Mod[#1,#2]&,i,Range[2,i+1]],0], {i,30}] (* Birkas Gyorgy, Feb 26 2011 *)
  • PARI
    a(n)=if(n<1, 0, s=n; c=1; while(s-s%c>0, s=s-s%c; c++); c--) \\ corrected by Dan Dima, Jan 18 2025

Formula

Conjecture: a(n) = sqrt(Pi*n) + O(1)
a(n) = A073047(n) - 1.

Extensions

Name corrected by Dan Dima, Jan 18 2025
Showing 1-3 of 3 results.