OFFSET
1,4
COMMENTS
Previous name was: The number of iterations for A153023 to converge when started at n.
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
EXAMPLE
With m(n) = A048050(n) we have: m(18) -> m(20) -> m(21) -> m(10) -> m(7) -> 0, thus a(18) = 5.
On the other hand, m(48) = 75 and m(75) = 48, so we ended in a cycle, thus a(48) = a(75) = -1. - Edited by Antti Karttunen, Nov 03 2017
MAPLE
f := proc(n) L := {} ; a := n ; while not isprime(a) do a := A048050(a) ; if a in L then RETURN(-1) ; fi; L := L union {a} ; od; 1+nops(L) ; end:
A153023 := proc(n) if n =1 then 1; elif isprime(n) then 1; else f(n) ; fi; end: # R. J. Mathar, May 25 2013
MATHEMATICA
With[{nn = 100}, Table[If[! CompositeQ[n], 1, Length@ NestWhileList[DivisorSigma[1, #] - (# + 1) &, n, Nor[PrimeQ@ #, # == 0] &, 1, 100]] /. k_ /; k == nn + 1 -> -1, {n, 104}]] (* Michael De Vlieger, Nov 03 2017 *)
PROG
(Scheme)
(define (A153024 n) (let loop ((n n) (visited (list n)) (i 0)) (let ((next (A048050 n))) (cond ((zero? n) i) ((member next visited) -1) (else (loop next (cons next visited) (+ 1 i)))))))
;; Antti Karttunen, Nov 03 2017
CROSSREFS
KEYWORD
sign
AUTHOR
Andrew Carter (acarter09(AT)newarka.edu), Dec 16 2008
EXTENSIONS
Name changed and more terms added by Antti Karttunen, Nov 03 2017
STATUS
approved