A333947 a(n) is the smallest k > 0 such that sigma(n+k) = sigma(n); if such k > 0 does not exist, then a(n) = 0.
0, 0, 0, 0, 0, 5, 0, 0, 0, 7, 0, 0, 0, 1, 8, 9, 0, 0, 0, 6, 10, 0, 0, 14, 0, 15, 0, 11, 0, 16, 0, 0, 2, 19, 12, 0, 0, 21, 0, 18, 0, 20, 0, 21, 0, 5, 0, 27, 0, 0, 4, 45, 0, 2, 16, 31, 22, 31, 0, 18, 0, 7, 40, 0, 18, 4, 0, 14, 8, 24, 0, 0, 0, 39, 0, 63, 0, 14, 0
Offset: 1
Keywords
Examples
sigma(9) = 13 and there is no k>0 such that sigma(9+k) = 13, then a(9) = 0. sigma(14) = sigma(15) = sigma(23) = 24, so a(14) = 1 and a(15) = 8, and as 23 is prime, a(23) = 0.
Links
- Robert Israel, Table of n, a(n) for n = 1..10000
- Max Alekseyev, PARI/GP Scripts for Miscellaneous Math Problems
Programs
-
Maple
f:= proc(n) local s,k; s:= numtheory:-sigma(n); for k from n+1 to s-1 do if numtheory:-sigma(k)=s then return k-n fi od; 0 end proc: map(f, [$1..100]); # Robert Israel, Apr 17 2020
-
Mathematica
a[n_] := Module[{k = n+1, s = DivisorSigma[1, n]}, While[k < s && DivisorSigma[1, k] != s, k++];If[k >= s, 0, k-n]]; Array[a, 70] (* Amiram Eldar, Apr 12 2020 *)
-
PARI
a(n) = {my(s=sigma(n)); for (k= n+1, s-1, if (sigma(k) == s, return (k-n));); return(0);} \\ Michel Marcus, Apr 11 2020
Comments