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.

A220664 First differences of A030299.

This page as a plain text file.
%I A220664 #34 Mar 31 2025 22:31:15
%S A220664 11,9,102,9,81,18,81,9,913,9,81,18,81,9,702,9,171,27,72,18,693,18,72,
%T A220664 27,171,9,702,9,81,18,81,9,8024,9,81,18,81,9,702,9,171,27,72,18,693,
%U A220664 18,72,27,171,9,702,9,81,18,81,9,5913,9,81,18,81,9,1602,9,261
%N A220664 First differences of A030299.
%C A220664 From _M. F. Hasler_, Jan 12 2013: (Start)
%C A220664 Note [updated Mar 03 2013]: The definition of sequence A030299 has been slightly modified in Jan. 2013, and as a consequence the following properties remain valid beyond the first A007489(9)-1 = 409112 terms, which had not been the case before, when A030299 had been defined through concatenation of the lexicographically ordered permutations, which in case of elements >= 10 broke up the nice mathematical properties (esp. of the sequence A219664 = 9*A217626 cited below).
%C A220664 This sequence taken modulo 9 is zero except (possibly) at indices where a run of permutations ends in A030299. (These indices are given by A007489(n), n>0.) There it equals (mod 9) the "n" of the following run. E.g., a(1)=2 (mod 9), and A030299(1+1)=12 is the start of the run for n=2; a(3)=3 (mod 9) and A030299(3+1)=123 is the start of the run for n=3, a(9)=4 (mod 9) and  A030299(9+1)=1234 is the start of the run for n=4, etc.
%C A220664 The subsequence between these indices (A007489(n)+1,...,A007489(n+1)-1), always starts with the same terms, listed in A219664 = 9*A217626 (= A209280 = A107346 where the latter are defined). (End)
%H A220664 Antti Karttunen, <a href="/A220664/b220664.txt">Table of n, a(n) for n = 1..5912</a>
%F A220664 a(n) = A030299(n+1) - A030299(n).
%F A220664 a(n) = A219664(n-A007489(k)), for A007489(k) < n < A007489(k+1). - _M. F. Hasler_, Jan 13 2013
%e A220664 A030299 starts (1, 12, 21, 123, 132, 213, 231, 312, ...), the first differences thereof yield (11, 9, 102, 9, 81, 18, 81, ...).
%p A220664 (l-> seq(l[j]-l[j-1], j=2..nops(l)))([seq(map(x-> parse(cat(x[])),
%p A220664      combinat[permute](n))[], n=0..5)])[];  # _Alois P. Heinz_, Nov 09 2021
%o A220664 (Scheme) (define (A220664 n) (- (A030299 (+ 1 n)) (A030299 n)))
%o A220664 (PARI) {A030299=concat( vector( 5,k, vecsort( vector( (#k=vector(k, j, 10^j)~\10)!, i, numtoperm(#k, i-1)*k )))); A220664=vecextract(A030299,"^1")-vecextract(A030299,"^-1")} \\ _M. F. Hasler_, Jan 12 2013
%o A220664 (Python)
%o A220664 from itertools import permutations
%o A220664 def pmap(s, m): return sum(s[i-1]*10**(m-i) for i in range(1, len(s)+1))
%o A220664 def agen():
%o A220664     m = 1
%o A220664     while True:
%o A220664         for s in permutations(range(1, m+1)): yield pmap(s, m)
%o A220664         m += 1
%o A220664 def aupton(terms):
%o A220664     alst, g = [], agen()
%o A220664     t = next(g)
%o A220664     while len(alst) < terms:
%o A220664         t, prevt = next(g), t
%o A220664         alst += [t - prevt]
%o A220664     return alst
%o A220664 print(aupton(65)) # _Michael S. Branicky_, Nov 09 2021
%Y A220664 The repeating part is given by A219664, equal to A107346 for indices < 5!.
%K A220664 nonn,base
%O A220664 1,1
%A A220664 _Antti Karttunen_, Dec 17 2012