%I #4 Mar 30 2012 17:36:44
%S 1,2,3,6,7,9,10,12,14,17,20,22,23,31,53,56,57,683,2983,2984,2985,
%T 149411,811160,811162,811163,75426842,476823319,476823329,476823330,
%U 73727027930,530824147003,530824147008,530824147009,126824134344110
%N Slowest-increasing monotonic sequence of positive integers such that for all n >= 1 the n-th term of the n-th differences is n.
%o (PARI) {calc_two_diags() = /* M, n, n2 inherited; down first diag., up next */
%o for(r=2, n, M[r,n2-r] = M[r-1,n2-r+1] - M[r-1,n2-r]);
%o forstep(r=n, 1, -1, M[r,n2-r+1] = M[r,n2-r] + M[r+1,n2-r])}
%o /* Find pair-by-pair first 2k terms of A153123 and put into row 1 of M. */
%o /* Row n+1 of M contains 2k-2n+1 terms of A153123's n-th differences -- */
%o /* for efficiency not starting until the n-th term in the n-th column. */
%o /* (Minor changes to program would calculate all n-th differences.) */
%o /* For larger k the PARI stack size may need to be increased first. */
%o {k = 450; M = matrix(k+1,2*k); M[1,1] = 1; M[1,2] = 2; M[2,1] = 1;
%o for(n=2, k, M[n+1,n] = n; n2 = 2*n; M[1,n2-1] = M[1,n2-2] + 1;
%o calc_two_diags();
%o if(M[1,n2] <= M[1,n2-1], /* If first try doesn't find increasing terms, */
%o M[1,n2-1] = M[1,n2-1] + 1 + floor(-M[2,n2-1]/(n-1)); calc_two_diags()));
%o /* the above adjusts both terms just enough.*/
%o M[1,] /* Print only first row of M */}
%o /* The above program uses these general facts: */
%o /* Increasing (Decreasing) one term, a(j), of a sequence by a constant c */
%o /* i) increases (decreases) each element of the leftmost changing */
%o /* diagonal of its difference array by c and */
%o /* ii) increases (decreases) the elements of the diagonal immediately */
%o /* to its right -- including a(j+1) -- by c, 2c, 3c, ..., dc, respectively,*/
%o /* for the d elements above a given element on this second diagonal*/
%o /* which is being held fixed, where dc is the change in a(j+1). */
%o /* (Incidentally, a similar pattern occurs for the elements below */
%o /* the fixed one but the sign of the changes is reversed.) */
%K nonn
%O 1,2
%A _Rick L. Shepherd_, Dec 18 2008
|