%I #240 Dec 15 2023 15:09:44
%S 1,9,2,9,1,78,1,19,3,8,2,77,2,8,3,19,1,78,1,9,2,9,1,657,1,9,2,9,1,178,
%T 1,29,4,7,3,66,2,18,4,18,2,67,1,19,3,8,2,646,1,19,3,8,2,67,1,29,4,7,3,
%U 176,3,7,4,29,1,67,2,8,3,19,1,646,2,8,3,19,1
%N First differences of A215940, or first differences of permutations of (0,1,2,...,m-1) reading them as decimal numbers, divided by 9 (with 10>=m, and m! > n).
%C Terms do not depend on the choice of m, provided that m!>n (the index of the considered term), and the numbers associated to a permutation s of {0,...,m-1} are N(s)=sum_{i=1..m} s(i)*10^(m-i). This defines the present sequence for any arbitrarily large index, not limited to n <= 10!, for example.
%C Similar sequences might be built in another base b, they would always start (1, b-1, 2, b-1, 1, ...). The partial sums of this kind of sequence would yield the analog of A215940 in the corresponding base.
%C There are at least two palindromic patterns which are repeated throughout this sequence: one of them is "1,b-1,2,b-1,1" (It is optional here whether or not to include the 1's), another is built from the first 4!-1 terms (See the corresponding link for details).
%C Also, for 1<=n<=(9!)-1: The repeating parts in the first differences of A030299 divided by nine, i.e. a(n) = A219664(n)/9. - _Antti Karttunen_, Dec 18 2012. Edited by: _R. J. Cano_, May 09 2017
%C There are more palindromic patterns than those mentioned above: Similar to the first 3!-1 and the first 4!-1 terms, the first k!-1 terms are repeated for all other k>4. Frequent are also multiples of these, e.g., k*[1,9,2,9,1] = [2,18,4,18,2], [3,27,6,27,3], ...), [1, 19, 3, 8, 2, 67, 1, 29, 4, 7, 3, 176, 3, 7, 4, 29, 1, 67, 2, 8, 3, 19, 1], and others. The "middle part" of roughly half the length (e.g., [9,2,9] or [67,...,67] in the last example), is repeated even more frequently. - _M. F. Hasler_, Jan 14 2013
%C From _R. J. Cano_, Apr 04 2016: (Start)
%C Conjecture 1: Given 1<n<=M two positive integers, the first n!-1 terms of this sequence are inserted (M-n+1)! times with (anti)symmetric distribution among the first M!-1 terms of this sequence. The described count and alternating pattern of symmetry is conserved whenever it is possible (i.e., when having enough terms) through successive differences and for the corresponding sequences (i.e., the first differences of A217626 and so on).
%C Lemma: Let P be an arbitrary set consisting of m integers; let x[i] be an element in P (with 1<=i<=m); let y[j] = x[j+1] - x[j] (with 1 <= j <= m-1) be the 1st differences of P. These differences are symmetric if y[j]=y[m-j] which for P implies the condition x[j]+x[m-j+1]=x[j+1]+x[m-j];
%C Consequence: When m=n! and P is a set with all the permutations for the letters 0..n-1, the preceding lemma implies P has associated at least a set Q such that 1st differences in Q are symmetric.
%C Generating algorithm: Such Q can be built based upon P and the condition given by the preceding lemma if it is removed from P (until P becomes empty) its 1st element tau, inserting them both in Q tau and its arithmetic complement to repdigit (n-1)*111...1 (n times 1) removing the mentioned complement from P.
%C Conjecture 2: The autosimilarity shown by a(n) is a consequence of the fact that the corresponding P is the set of the n! permutations in increasing sequence for the letters 0..n-1, and Q=P (it holds if they are replaced "a(n)" and "increasing" respectively with "-1*a(n)" and "decreasing").
%C Note: "Q=P" is a necessary but not sufficient condition for observing the autosimilarity in a(n).
%C Application: The "generating algorithm" described previously might be potentially useful for parallel computing. In combination with the partition scheme proposed at links in A237265, and multiple indirection. For example notice that in such sense an algorithm for generating k! permutations with an increasing sequence would require only k!/2 iterations because the other half would be already determined by symmetry.
%C Conjecture 3: For n>2, given P the set of permutations in increasing sequence for the letters 0..n-1, there are distributed with a symmetric pattern among its (n!)! permutations all those A000165(n!\2) of them such that their 1st differences are symmetric. Moreover by setting to zero the other elements whose 1st differences are not symmetric, we obtain an antisymmetric sequence.
%C (End)
%C Conjecture 4: If 2<=m<n, and S is defined as the first differences of a sequence giving the starting position of each repetition for the first m!-1 terms inside the first n!-1 terms, then each element in S is 0 mod m!. - _R. J. Cano_, Apr 19 2017
%C Consider the first y!-1 terms for even y; The central term a(y!/2) is determined by the difference between the (y/2+1)th row from the yth matrix defining the irregular table in A237265 and the consecutive permutation preceding it in lexicographic order (See EXAMPLE). - _R. J. Cano_, May 09 2017
%H A. Karttunen, <a href="/A217626/b217626.txt">Table of n, a(n) for n = 1..40319</a>
%H R. J. Cano, <a href="/wiki/File:Extended_b217626_woOffsets.txt.gz">Compressed file: a(n) for n = 1..3628799, the first 10!-1 terms of this sequence.</a>
%H R. J. Cano, <a href="/A217626/a217626_2.txt">Additional information about this sequence.</a>
%H R. J. Cano, <a href="http://oeis.org/w/images/e/e6/A217626.c">Template for a base-independent sequencer in C.</a>
%F a(n) = A215940(n+1) - A215940(n).
%F a(n) = A219664(n)/9, for n=1..362879. - _Antti Karttunen_, Dec 18 2012
%F a(n) = A209280(n)/9, for n < 9!. - _M. F. Hasler_, Jan 12 2013
%e a(1)= A215940(2) - A215940(1) = 1 - 0 = 1.
%e a(2)= A215940(3) - A215940(2) = 10-01 = 9.
%e a(3)= A215940(4) - A215940(3) = 12-10 = 2.
%e a(4)= A215940(5) - A215940(4) = 21-12 = 9.
%e a(5)= A215940(6) - A215940(5) = 22-21 = 1.
%e [ From _R. J. Cano_, May 09 2017: Start ]
%e On the central terms for subsequences consisting of the first y!-1 terms with even y: Let us pick y=4; The first y!-1=23 terms are,
%e (1,9,2,9,1,78,1,19,3,8,2,77,2,8,3,19,1,78,1,9,2,9,1)
%e the central term there is a(12)=77; If we look into A237265, the 4th matrix defining it contains as its (4/2+1)th or third row, the permutation 3124 which in lexicographic order is preceded by 2431, therefore by subtracting and dividing by 9 we obtain:
%e (3124-2431)/9 = 693/9 = (2013-1320)/9 = 77 = a(12); [End]
%p A217626:=n->A215940(n+1)-A215940(n);
%t maxm = 5; Table[dd = FromDigits /@ Permutations[Range[m]]; (Drop[dd, If[m == 1, 0, (m - 1)!]] - First[dd])/9, {m, 1, maxm}] // Flatten // Differences (* _Jean-François Alcover_, Apr 25 2013 *)
%o (C) // See LINKS.
%o (Scheme) (define (A217626 n) (/ (A219664 n) 9)) ;; - _Antti Karttunen_, Dec 18 2012
%o (PARI) first_terms(n)={n=max(3,n);my(m:small=n!);my(a:vec=vector(m-1),i:small=0,x:vec=numtoperm(n,0),y:vec,z:vec,u:small,B:small=11);m\=2;m--;while(i++<=m,u=!(i%6);y=numtoperm(n,i);z=(y-x)[1..n-1];if(u,z=vector(#z,j,vecsum(z[1..j])));a[i]=fromdigits(z,B-u);a[#a-i+1]=a[i];x=y;);z=(numtoperm(n,m+1)-y)[1..n-1];a[m+1]=fromdigits(vector(#z,j,vecsum(z[1..j])),B--);return(a)} \\ Computes the first either 5 or n!-1 terms. - _R. J. Cano_, May 28 2017
%Y Cf. A215940, A207324, A219664, A220664, A030299.
%Y Cf. A219995 [ On the summation of 1/a(n) ].
%K nonn,base,easy
%O 1,2
%A _R. J. Cano_, Oct 04 2012
%E Definition simplified by _M. F. Hasler_, Jan 12 2013