OFFSET
1,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
Antti Karttunen, Scheme (Racket) program to compute this sequence
FORMULA
EXAMPLE
For n = 1, sigma(1) = 1, and the arguments for gcd are equal at the start, thus a(1) = 0.
For n = 2, sigma(2) = 3, gcd(3,2) = gcd(2,1) = gcd(1,1), thus 2 steps were required to reach the termination condition, and a(2) = 2.
For n = 6, sigma(6) = 12, gcd(12,6) = gcd(6,6), thus a(6) = 1.
For n = 9, sigma(9) = 13, gcd(13,9) = gcd(9,4) = gcd(5,4) = gcd(4,1) = gcd(3,1) = gcd(2,1) = gcd(1,1), thus a(9) = 6.
Here the simple subtracting version of gcd-algorithm is used, where the new arguments will be the smaller argument and the smaller argument subtracted from the larger, and this is repeated until both are equal.
PROG
(Scheme) (define (A286594 n) (A285721bi n (A000203 n))) ;; Requires also code from A000203 and A285721.
(Python)
from sympy import divisor_sigma
def A(n, k): return 0 if n==k else 1 + A(abs(n - k), min(n, k))
def a(n): return A(n, divisor_sigma(n)) # Indranil Ghosh, May 22 2017
(PARI)
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, May 21 2017
STATUS
approved