%I #52 Dec 27 2023 11:55:48
%S 6,28,220,284,496,1184,1210,2620,2924,5020,5564,6232,6368,8128,10744,
%T 10856,12285,14595,17296,18416,63020,66928,66992,67095,69615,71145,
%U 76084,79750,87633,88730,100485,122265,122368,123152,124155,139815,141664,142310,153176
%N Numbers k such that sigma(k) = sigma(sigma(k)-k).
%C For all k, let s(k) = sigma(k) - k, the aliquot sum function A001065; then this sequence is the set of k such that s(s(k)) = k. - _Jeppe Stig Nielsen_, Jan 12 2020
%H Giovanni Resta, <a href="/A206708/b206708.txt">Table of n, a(n) for n = 1..10000</a> (first 1000 terms from Amiram Eldar)
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/PerfectNumber.html">Perfect Number</a>
%H Eric Weisstein's World of Mathematics, <a href="http://mathworld.wolfram.com/AmicablePair.html">Amicable Pair</a>
%H Wikipedia, <a href="http://www.wikipedia.org/wiki/Perfect_number">Perfect number</a>
%H Wikipedia, <a href="http://www.wikipedia.org/wiki/Amicable_number">Amicable number</a>
%F Equals {A063990} union {A000396} = (amicable numbers) union (perfect numbers).
%e 220 is in the sequence because sigma(220) = 504, sigma(504 - 220) = sigma(284) = 504.
%p q:= n-> (s-> s(n)=s(s(n)-n))(numtheory[sigma]):
%p select(q, [$1..100000])[]; # _Alois P. Heinz_, Jan 31 2023
%t Select[Range[10^6],DivisorSigma[1,#]==DivisorSigma[1, DivisorSigma[1,#]-#]&]
%o (PARI) isok(k) = if (k != 1, my(sk=sigma(k)); sk == sigma(sk-k)); \\ _Michel Marcus_, Jun 24 2019
%o (Magma) [k:k in [2..154000]|s eq DivisorSigma(1,s-k) where s is DivisorSigma(1,k)]; // _Marius A. Burtea_, Jan 13 2020
%Y Cf. A000396 (perfect numbers), A063990 (amicable numbers).
%Y Cf. A000203 (sum of divisors), A001065 (sum of proper divisors).
%K nonn
%O 1,1
%A _Michel Lagneau_, Feb 11 2012