OFFSET
1,2
LINKS
Antti Karttunen, Table of n, a(n) for n = 1..10000
EXAMPLE
a(18) -> {2,3,6,9} -> 20 -> {2,4,5,10} -> 21 -> {3,7} -> 10 -> {2,5} -> 7 = 7.
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; a ; end:
A048050 := proc(n) numtheory[sigma](n)-n-1 ; end:
A153023 := proc(n) if n =1 then 1; elif isprime(n) then n; else f(n) ; fi; end: # R. J. Mathar, Dec 19 2008
MATHEMATICA
Table[If[! CompositeQ[n], n, NestWhile[DivisorSigma[1, #] - (# + 1) &, n, Nor[PrimeQ@ #, # == 0] &, 1, 100] /. k_ /; CompositeQ@ k -> -1], {n, 85}] (* Michael De Vlieger, Nov 03 2017 *)
PROG
(Scheme)
(define (A153023 n) (let loop ((n n) (visited (list n))) (let ((next (A048050 n))) (cond ((or (= 1 n) (= 1 (A010051 n))) n) ((member next visited) -1) (else (loop next (cons next visited)))))))
;; Antti Karttunen, Nov 03 2017
CROSSREFS
KEYWORD
sign
AUTHOR
Andrew Carter (acarter09(AT)newarka.edu), Dec 16 2008
EXTENSIONS
Extended by R. J. Mathar, Dec 19 2008
Description clarified by Antti Karttunen, Nov 03 2017
STATUS
approved