OFFSET
1,1
COMMENTS
EXAMPLE
The aliquot sequence 220->284->220->... has the requested form, so 220 is here.
1064 is here too since its aliquot sequence is 1064->1336->1184->1210->... .
PROG
(PARI) isAmicable(n)={my(a=sigma(n)-n); (a<>n) && (sigma(a)-a)==n; } \\ from A063990
isSociableADAD(n)={my(a=sigma(n)-n); if (!a, return (0)); my(b=sigma(a)-a); if(! b, return (0)); my(c=sigma(b)-b); if (!c, return (0)); my(d=sigma(c)-c); if (d != n, return (0)); ((n>a) && (a<b) && (b>c) && (c<n)) || ((n<a) && (a>b) && (b<c) && (c>n)); }
isok(n) = {my(oldn = n); my(newn = sigma(oldn) - oldn); my(dir = sign(newn - oldn)); if (!dir || (dir < 0), return (0)); oldn = newn; while (1, newn = sigma(oldn) - oldn; ndir = sign(newn - oldn); if (!ndir || (ndir == dir), return (0)); if (isAmicable(oldn), return(1)); if (isSociableADAD(oldn), return(1)); oldn = newn; dir = ndir; ); }
CROSSREFS
KEYWORD
nonn
AUTHOR
Michel Marcus, Jan 02 2014
STATUS
approved