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 A382483 #27 Apr 08 2025 21:58:29 %S A382483 5,3,2,1,0,6,2,9,7,10,6,0,8,4,4,3,10,11,8,14,4,8,4,32,3,14,12,28,2,44, %T A382483 4,35,20,26,20,63,10,32,28,62,14,68,16,56,50,44,20,96,29,65,44,70,26, %U A382483 92,44,92,52,62,32,140,34,68,76,99,56,116,40,98,68,116,44,167,46,86,96,112,68,140 %N A382483 a(n) = smallest number k such that at least one of sigma(n) - k and sigma(n) + k is a perfect number. %F A382483 a(A081357(k)) = 0. %F A382483 a(A146542(k)) = 0. %F A382483 a(A000396(k)) = A000396(k). %e A382483 sigma(6) = 12, the nearest perfect number is 6, thus a(6) = 12 - 6 = 6. %e A382483 sigma(26) = 42, the nearest perfect number is 28, thus a(26) = 42 - 28 = 14. %p A382483 isA000396 := proc(n::integer) %p A382483 if n < 6 then %p A382483 false ; %p A382483 elif numtheory[sigma](n) = 2*n then %p A382483 true; %p A382483 else %p A382483 false; %p A382483 end if; %p A382483 end proc: %p A382483 A382483 := proc(n) %p A382483 local k ; %p A382483 for k from 0 do %p A382483 if isA000396(numtheory[sigma](n)-k) or isA000396(numtheory[sigma](n)+k) then %p A382483 return k; %p A382483 end if; %p A382483 end do: %p A382483 end proc: %p A382483 seq(A382483(n),n=1..50) ; # _R. J. Mathar_, Apr 01 2025 %o A382483 (PARI) isp(x) = if (x>0, sigma(x) == 2*x); %o A382483 a(n) = my(k=0, s=sigma(n)); while (!(isp(s-k) || isp(s+k)), k++); k; \\ _Michel Marcus_, Apr 01 2025 %Y A382483 Cf. A000396, A081357, A146542, A382506. %K A382483 nonn,easy %O A382483 1,1 %A A382483 _Leo Hennig_, Mar 27 2025