OFFSET
1,3
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..65537
Antti Karttunen, Scheme (Racket) program to compute this sequence
EXAMPLE
For n = 1, phi(1) = 1, and the arguments for gcd are equal at the start, thus a(1) = 0.
For n = 2, eulerphi(2) = 1, gcd(2,1) = gcd(1,1), thus 1 step were required to reach the termination condition, and a(2) = 1.
For n = 5, eulerphi(5) = 4, gcd(5,4) = gcd(4,1) = gcd(3,1) = gcd(2,1) = gcd(1,1), four steps required, thus a(5) = 4.
For n = 6, eulerphi(6) = 2, gcd(6,2) = gcd(4,2) = gcd(2,2), two steps required, thus a(6) = 2.
Here a simple subtracting version of gcd-algorithm is used, where the new versions of two arguments will be the smaller argument and the smaller argument subtracted from the larger, and this is repeated until both are equal.
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Mar 02 2018
STATUS
approved