Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
a(n) is the row index where the first term in column n of A225630 equivalent to some term in column n of A225640 is found from.
7

%I #23 Mar 14 2018 03:47:37

%S 0,0,1,1,1,2,1,2,2,2,2,3,3,2,5,5,4,3,6,3,5,5,3,3,6,6,7,7,5,3,8,5,8,6,

%T 9,6,6,5,10,7,9,4,4,4,8,8,8,4,9,11,12,8,8,4,11,11,10,9,10,5,7,5,12,12,

%U 13,12,9,6,10,12,9,7,6,7,13,12,12,12,13,7,14,14

%N a(n) is the row index where the first term in column n of A225630 equivalent to some term in column n of A225640 is found from.

%C Consider an algorithm which finds a maximum value lcm(p1,p2,...,pk,prevmax) among all partitions {p1+p2+...+pk} of n, where the "seed number" prevmax is such a maximum value from the previous iteration.

%C a(n) tells the number of such iterations needed, when starting from the initial seed value 1, for the process to reach the first identical value (A226055(n)) that is eventually produced when the same algorithm is started with the initial seed value of n.

%F a(n) = A225639(n) + A225654(n) = A225634(n) - A226056(n). (But please see the Scheme-program how this sequence actually can be computed.)

%F A226055(n) = A225630(a(n),k) = A225640(A225639(n),k).

%e Looking at A225632 and A225642, which are just arrays A225630 and A225640 transposed and repeating values removed, we see that:

%e row 11 of A225632 is 1, 30, 420, 4620, 13860, 27720;

%e row 11 of A225642 is 11, 330, 4620, 13860, 27720;

%e their first common term, 4620 (= A226055(11)), occurs as three positions after the initial 1 of that row in A225632, thus a(11)=3.

%e Equivalently, 4620 occurs as the element A(3,11) of array A225630.

%o (Scheme):

%o (define (A225638 n) (if (zero? n) n (let ((fun1 (lambda (seed) (let ((max1 (list 0))) (fold_over_partitions_of n 1 lcm (lambda (p) (set-car! max1 (max (car max1) (lcm seed p))))) (car max1)))) (fun2 (lambda (seed) (let ((max2 (list 0))) (fold_over_partitions_of n (max 1 n) lcm (lambda (p) (set-car! max2 (max (car max2) (lcm seed p))))) (car max2))))) (steps-to-convergence-nondecreasing fun1 fun2 1 n))))

%o (define (fold_over_partitions_of m initval addpartfun colfun) (let recurse ((m m) (b m) (n 0) (partition initval)) (cond ((zero? m) (colfun partition)) (else (let loop ((i 1)) (recurse (- m i) i (+ 1 n) (addpartfun i partition)) (if (< i (min b m)) (loop (+ 1 i))))))))

%o (define (steps-to-convergence-nondecreasing fun1 fun2 initval1 initval2) (let loop ((steps 0) (a1 initval1) (a2 initval2)) (cond ((equal? a1 a2) steps) ((< a1 a2) (loop (+ steps 1) (fun1 a1) a2)) (else (loop steps a1 (fun2 a2))))))

%K nonn

%O 0,6

%A _Antti Karttunen_, May 20 2013