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 A333947 #46 Jul 19 2021 01:22:13 %S A333947 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, %T A333947 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, %U A333947 0,7,40,0,18,4,0,14,8,24,0,0,0,39,0,63,0,14,0 %N 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. %C A333947 This sequence is inspired by A007365 where a(n) is the smallest k such that sigma(n+k) = sigma(k); indeed, n and k are switched between these two sequences. %C A333947 There are three distinct cases for which a(n) = 0: %C A333947 If n is prime then a(n) = 0, %C A333947 If n is in A211658 then a(n) = 0, %C A333947 If n is the largest number q_r of a sequence q_1 < q_2 < ... < q_r with q_r composite and sigma(q_1) = sigma(q_2) = ... = sigma(q_r) then a(n) = 0. The first two such examples are a(25) = 0 and a(39) = 0 with sigma(16) = sigma(25) = 31, and sigma(28) = sigma(39) = 56. %H A333947 Robert Israel, <a href="/A333947/b333947.txt">Table of n, a(n) for n = 1..10000</a> %H A333947 Max Alekseyev, <a href="https://home.gwu.edu/~maxal/gpscripts/">PARI/GP Scripts for Miscellaneous Math Problems</a> %e A333947 sigma(9) = 13 and there is no k>0 such that sigma(9+k) = 13, then a(9) = 0. %e A333947 sigma(14) = sigma(15) = sigma(23) = 24, so a(14) = 1 and a(15) = 8, and as 23 is prime, a(23) = 0. %p A333947 f:= proc(n) local s,k; %p A333947 s:= numtheory:-sigma(n); %p A333947 for k from n+1 to s-1 do %p A333947 if numtheory:-sigma(k)=s then return k-n fi %p A333947 od; %p A333947 0 %p A333947 end proc: %p A333947 map(f, [$1..100]); # _Robert Israel_, Apr 17 2020 %t A333947 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 *) %o A333947 (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 %Y A333947 Cf. A000203, A007365, A054973. %Y A333947 Cf. A002961 (a(n)=1). %K A333947 nonn %O A333947 1,6 %A A333947 _Bernard Schott_, Apr 11 2020