cp's OEIS Frontend

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.

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.

Original entry on oeis.org

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

Views

Author

Bernard Schott, Apr 11 2020

Keywords

Comments

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.
There are three distinct cases for which a(n) = 0:
If n is prime then a(n) = 0,
If n is in A211658 then a(n) = 0,
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.

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.
		

Crossrefs

Cf. A002961 (a(n)=1).

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