This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.
%I A153023 #15 Nov 03 2017 09:55:39 %S A153023 1,2,3,2,5,5,7,5,3,7,11,5,13,3,5,3,17,7,19,7,7,13,23,5,5,5,5,5,29,41, %T A153023 31,41,3,19,5,7,37,7,3,7,41,53,43,3,41,5,47,-1,7,53,7,41,53,7,3,7,13, %U A153023 31,59,107,61,3,7,3,7,7,67,13,5,73,71,7,73,3,-1,7,7,89,79,41,3,43,83,139,13 %N A153023 If n is 1 or prime then a(n) = n. Otherwise, start with n and iterate the map k -> A048050(k) until we reach a prime p; then a(n) = p. If we never reach a prime, a(n) = -1. A048050 gives the sum of proper divisors of k, excluding both 1 and n from the sum. %H A153023 Antti Karttunen, <a href="/A153023/b153023.txt">Table of n, a(n) for n = 1..10000</a> %e A153023 a(18) -> {2,3,6,9} -> 20 -> {2,4,5,10} -> 21 -> {3,7} -> 10 -> {2,5} -> 7 = 7. %p A153023 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: %p A153023 A048050 := proc(n) numtheory[sigma](n)-n-1 ; end: %p A153023 A153023 := proc(n) if n =1 then 1; elif isprime(n) then n; else f(n) ; fi; end: # _R. J. Mathar_, Dec 19 2008 %t A153023 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 *) %o A153023 (Scheme) %o A153023 (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))))))) %o A153023 (define (A048050 n) (if (= 1 n) 0 (- (A001065 n) 1))) %o A153023 (define (A001065 n) (- (A000203 n) n)) ;; For an implementation of A000203, see under that entry. %o A153023 ;; _Antti Karttunen_, Nov 03 2017 %Y A153023 Cf. A001065, A048050, A120716, A153024. %K A153023 sign %O A153023 1,2 %A A153023 Andrew Carter (acarter09(AT)newarka.edu), Dec 16 2008 %E A153023 Extended by _R. J. Mathar_, Dec 19 2008 %E A153023 Description clarified by _Antti Karttunen_, Nov 03 2017