|
|
A038722
|
|
Take the sequence of natural numbers (A000027) and reverse successive subsequences of lengths 1,2,3,4,... .
|
|
32
|
|
|
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, 23, 22, 36, 35, 34, 33, 32, 31, 30, 29, 45, 44, 43, 42, 41, 40, 39, 38, 37, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 66, 65, 64, 63, 62, 61, 60, 59, 58, 57, 56, 78, 77, 76
(list;
table;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,2
|
|
COMMENTS
|
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
A reordering of the natural numbers.
The sequence is self-inverse in that a(a(n)) = n.
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)
|
|
REFERENCES
|
Suggested by correspondence with Michael Somos.
R. Honsberger, "Ingenuity in Mathematics", Table 10.4 on page 87.
|
|
LINKS
|
|
|
FORMULA
|
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.
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
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.
a(n) = n for n = 2k(k+1)+1, k >= 0.
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.
a(n) = ceiling((sqrt(8n+1)-1)/2)^2 - n + 1. (End)
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
|
|
EXAMPLE
|
The rectangular array view is
1 2 4 7 11 16 22 29 37 46
3 5 8 12 17 23 30 38 47 57
6 9 13 18 24 31 39 48 58 69
10 14 19 25 32 40 49 59 70 82
15 20 26 33 41 50 60 71 83 96
21 27 34 42 51 61 72 84 97 111
28 35 43 52 62 73 85 98 112 127
36 44 53 63 74 86 99 113 128 144
45 54 64 75 87 100 114 129 145 162
55 65 76 88 101 115 130 146 163 181
|
|
MATHEMATICA
|
(* Program generates dispersion array T of the increasing sequence f[n] *)
r=40; r1=12; c=40; c1=12; f[n_] := Floor[1/2+Sqrt[2n]]
(* complement of column 1 *)
mex[list_] := NestWhile[#1 + 1 &, 1, Union[list][[#1]] <= #1 &, 1, Length[Union[list]]]
rows = {NestList[f, 1, c]};
Do[rows = Append[rows, NestList[f, mex[Flatten[rows]], r]], {r}];
t[i_, j_] := rows[[i, j]];
TableForm[Table[t[i, j], {i, 1, r1}, {j, 1, c1}]]
Flatten[Table[t[k, n - k + 1], {n, 1, c1}, {k, 1, n}]]
Table[ n, {m, 12}, {n, m (m + 1)/2, m (m - 1)/2 + 1, -1}] // Flatten (* or *)
Table[ Ceiling[(Sqrt[8 n + 1] - 1)/2]^2 - n + 1, {n, 78}] (* Robert G. Wilson v, Jun 27 2014 *)
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 *)
|
|
PROG
|
(PARI) a(n)=local(t=floor(1/2+sqrt(2*n))); if(n<1, 0, t^2-n+1) /* Paul D. Hanna */
(Haskell)
a038722 n = a038722_list !! (n-1)
a038722_list = concat a038722_tabl
a038722_tabl = map reverse a000027_tabl
a038722_row n = a038722_tabl !! (n-1)
|
|
CROSSREFS
|
A self-inverse permutation of the natural numbers.
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|