login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A322987
Number of iterations of A049820(x) = x - A000005(x) needed to reach a square, when starting from x = n.
3
0, 0, 1, 1, 0, 2, 2, 3, 1, 0, 3, 1, 3, 2, 4, 2, 0, 3, 4, 4, 5, 4, 5, 5, 1, 0, 6, 6, 6, 7, 6, 8, 7, 8, 7, 9, 0, 10, 8, 10, 8, 11, 8, 12, 9, 11, 9, 12, 9, 0, 10, 13, 10, 14, 10, 14, 10, 15, 11, 16, 10, 17, 12, 16, 0, 18, 12, 19, 13, 19, 13, 20, 11, 21, 14, 20, 14, 22, 14, 23, 14, 0, 15, 1, 12, 1, 16, 2, 15, 3, 15, 3, 17, 4, 16, 4, 13, 5, 18, 5, 0
OFFSET
0,6
FORMULA
If A010052(n) == 1 [when n is in A000290], then a(n) = 0, otherwise a(n) = 1+a(A049820(n)).
a(n) <= A155043(n).
For n >= 83, a(2*n) = A322996(2*n)-1. [Note that 2*83 = 166 > 144 = A262514(2).]
PROG
(PARI) A322987(n) = if(issquare(n), 0, 1+A322987(n-numdiv(n)));
(PARI) A322987(n) = { for(j=0, oo, if(issquare(n), return(j)); n -= numdiv(n)); };
KEYWORD
nonn
AUTHOR
Antti Karttunen, Jan 05 2019
STATUS
approved