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.

A038722 Take the sequence of natural numbers (A000027) and reverse successive subsequences of lengths 1,2,3,4,... .

This page as a plain text file.
%I A038722 #76 Apr 04 2025 03:31:45
%S A038722 1,3,2,6,5,4,10,9,8,7,15,14,13,12,11,21,20,19,18,17,16,28,27,26,25,24,
%T A038722 23,22,36,35,34,33,32,31,30,29,45,44,43,42,41,40,39,38,37,55,54,53,52,
%U A038722 51,50,49,48,47,46,66,65,64,63,62,61,60,59,58,57,56,78,77,76
%N A038722 Take the sequence of natural numbers (A000027) and reverse successive subsequences of lengths 1,2,3,4,... .
%C A038722 Ramanujan theta functions: f(q) (see A121373), phi(q) (A000122), psi(q) (A010054), chi(q) (A000700).
%C A038722 The rectangular array having A038722 as antidiagonals is the transpose of the rectangular array given by A000217. Column 1 of array A038722 is A000124 (central polygonal numbers). Array A038722 is the dispersion of the complement of A000124. - _Clark Kimberling_, Apr 05 2003
%C A038722 a(n) is the smallest number not yet in the sequence such that n + a(n) is one more than a square. - _Franklin T. Adams-Watters_, Apr 06 2009
%C A038722 From _Hieronymus Fischer_, Apr 30 2012: (Start)
%C A038722 A reordering of the natural numbers.
%C A038722 The sequence is self-inverse in that a(a(n)) = n.
%C A038722 Also: a(1) = 1, a(n) = m (where m is the least triangular number > a(k) for 1 <= k < n), if the minimal natural number not yet in the sequence is greater than a(n-1), otherwise a(n) = a(n-1)-1. (End)
%D A038722 Suggested by correspondence with Michael Somos.
%D A038722 R. Honsberger, "Ingenuity in Mathematics", Table 10.4 on page 87.
%H A038722 Hieronymus Fischer, <a href="/A038722/b038722.txt">Table of n, a(n) for n = 1..11401</a>
%H A038722 Michael Somos, <a href="/A010815/a010815.txt">Introduction to Ramanujan theta functions</a>
%H A038722 Eric Weisstein's World of Mathematics, <a href="https://mathworld.wolfram.com/RamanujanThetaFunctions.html">Ramanujan Theta Functions</a>
%H A038722 <a href="/index/Per#IntegerPermutation">Index entries for sequences that are permutations of the natural numbers</a>
%F A038722 a(n) = (sqrt(2n-1) - 1/2)*(sqrt(2n-1) + 3/2) - n + 2 = A061579(n-1) + 1. Seen as a square table by antidiagonals, T(n, k) = k + (n+k-1)*(n+k-2)/2, i.e., the transpose of A000027 as a square table.
%F A038722 G.f.: g(x) = (x/(1-x))*(psi(x) - x/(1-x) + 2*Sum_{k>=0} k*x^(k*(k+1)/2)) where psi(x) = Sum_{k>=0} x^(k*(k+1)/2) = (1/2)*x^(-1/8)*theta_2(0,x^(1/2)) is a Ramanujan theta function. - _Hieronymus Fischer_, Aug 08 2007
%F A038722 a(n) = floor(sqrt(2*n) + 1/2)^2 - n + 1. - _Clark Kimberling_, Jun 05 2011; corrected by _Paul D. Hanna_, Jun 27 2011
%F A038722 From _Hieronymus Fischer_, Apr 30 2012: (Start)
%F A038722 a(n) = a(n-1)-1, if a(n-1)-1 > 0 is not in the set {a(k)| 1<=k<n}, otherwise a(n) = m, where m is the least triangular number not yet in the sequence.
%F A038722 a(n) = n for n = 2k(k+1)+1, k >= 0.
%F A038722 a(n+1) = (m+2)(m+3)/2, if 8a(n)-7 is a square of an odd number, otherwise a(n+1) = a(n)-1, where m = (sqrt(8a(n)-7)-1)/2.
%F A038722 a(n) = ceiling((sqrt(8n+1)-1)/2)^2 - n + 1. (End)
%F A038722 G.f. as rectangular array: x*y*(1 - (1 + x)*y + (1 - x + x^2)*y^2)/((1 - x)^3*(1 - y)^3). - _Stefano Spezia_, Dec 25 2022
%e A038722 The rectangular array view is
%e A038722    1    2    4    7   11   16   22   29   37   46
%e A038722    3    5    8   12   17   23   30   38   47   57
%e A038722    6    9   13   18   24   31   39   48   58   69
%e A038722   10   14   19   25   32   40   49   59   70   82
%e A038722   15   20   26   33   41   50   60   71   83   96
%e A038722   21   27   34   42   51   61   72   84   97  111
%e A038722   28   35   43   52   62   73   85   98  112  127
%e A038722   36   44   53   63   74   86   99  113  128  144
%e A038722   45   54   64   75   87  100  114  129  145  162
%e A038722   55   65   76   88  101  115  130  146  163  181
%t A038722 (* Program generates dispersion array T of the increasing sequence f[n] *)
%t A038722 r=40; r1=12; c=40; c1=12; f[n_] := Floor[n+1/2+Sqrt[2n]]
%t A038722   (* complement of column 1 *)
%t A038722 mex[list_] := NestWhile[#1 + 1 &, 1, Union[list][[#1]] <= #1 &, 1, Length[Union[list]]]
%t A038722 rows = {NestList[f, 1, c]};
%t A038722 Do[rows = Append[rows, NestList[f, mex[Flatten[rows]], r]], {r}];
%t A038722 t[i_, j_] := rows[[i, j]];
%t A038722 TableForm[Table[t[i, j], {i, 1, r1}, {j, 1, c1}]]
%t A038722 (* A038722 array *)
%t A038722 Flatten[Table[t[k, n - k + 1], {n, 1, c1}, {k, 1, n}]] (* A038722 sequence *)
%t A038722  (* _Clark Kimberling_, Jun 06 2011, corrected Jan 26 2025 *)
%t A038722 Table[ n, {m, 12}, {n, m (m + 1)/2, m (m - 1)/2 + 1, -1}] // Flatten (* or *)
%t A038722 Table[ Ceiling[(Sqrt[8 n + 1] - 1)/2]^2 - n + 1, {n, 78}] (* _Robert G. Wilson v_, Jun 27 2014 *)
%t A038722 With[{nn=20},Reverse/@TakeList[Range[(nn(1+nn))/2],Range[nn]]//Flatten] (* Requires Mathematica version 11 or later *) (* _Harvey P. Dale_, Dec 14 2017 *)
%o A038722 (PARI) a(n)=local(t=floor(1/2+sqrt(2*n))); if(n<1, 0, t^2-n+1) /* _Paul D. Hanna_ */
%o A038722 (Haskell)
%o A038722 a038722 n = a038722_list !! (n-1)
%o A038722 a038722_list = concat a038722_tabl
%o A038722 a038722_tabl = map reverse a000027_tabl
%o A038722 a038722_row n = a038722_tabl !! (n-1)
%o A038722 -- _Reinhard Zumkeller_, Nov 08 2013
%Y A038722 A self-inverse permutation of the natural numbers.
%Y A038722 Cf. A000027, A020703.
%Y A038722 Cf. A132666, A132664, A132665, A132674.
%Y A038722 Cf. A056011 (boustrophedon).
%Y A038722 Cf. A000122, A000700, A010054, A121373.
%Y A038722 Cf. A000124, A000217.
%Y A038722 Cf. A061579.
%K A038722 nonn,easy,tabl
%O A038722 1,2
%A A038722 _N. J. A. Sloane_, May 02 2000