OFFSET
1,1
EXAMPLE
In the following table, column A lists the n-th composite and column B lists sigma(A(n)).
n | A | B | a(n)
---------------------
1 | 4 | 7 | 7
2 | 6 | 12 | 0
3 | 8 | 15 | 0
4 | 9 | 13 | 0
5 | 10 | 18 | 0
6 | 12 | 28 | 0
7 | 14 | 24 | 0
8 | 15 | 24 | 24 <--- first time a value of sigma occurs twice
9 | 16 | 31 | 24
10 | 18 | 39 | 24
11 | 20 | 42 | 24
12 | 21 | 32 | 24
13 | 22 | 36 | 24
14 | 24 | 60 | 24
15 | 25 | 31 | 0 <--- second time a value of sigma occurs twice
16 | 26 | 42 | 0
17 | 27 | 40 | 0
18 | 28 | 56 | 0
19 | 30 | 72 | 0
20 | 32 | 63 | 0
21 | 33 | 48 | 0
22 | 34 | 54 | 0
23 | 35 | 48 | 0
24 | 36 | 91 | 0
25 | 38 | 60 | 0
26 | 39 | 56 | 0
27 | 40 | 90 | 0
28 | 42 | 96 | 0
29 | 44 | 84 | 0
30 | 45 | 78 | 0
31 | 46 | 72 | 0
32 | 48 | 124 | 0
33 | 49 | 57 | 0
34 | 50 | 93 | 0
35 | 51 | 72 | 72 <--- first time a value of sigma occurs three times
36 | 52 | 98 | 72
37 | 54 | 120 | 72
38 | 55 | 72 | 72 <--- fourth occurrence of the value 72
39 | 56 | 120 | 72
40 | 57 | 80 | 72
41 | 58 | 90 | 72
42 | 60 | 168 | 72
43 | 62 | 96 | 72
44 | 63 | 104 | 72
45 | 64 | 127 | 72
46 | 65 | 84 | 72
47 | 66 | 144 | 72
48 | 68 | 126 | 72
49 | 69 | 96 | 72
50 | 70 | 144 | 72
51 | 72 | 195 | 72
52 | 74 | 114 | 72
53 | 75 | 124 | 72
54 | 76 | 140 | 72
55 | 77 | 96 | 0 <--- another value apart from 72 occurs four times
56 | 78 | 168 | 0
MAPLE
N:= 100: # to get a(1)..a(N)
cmax:= 3*N: Counts:= Vector(cmax):
i:= 0:
for n from 4 do
if isprime(n) then next fi;
i:= i+1;
if i > N then break fi;
s:= numtheory:-sigma(n);
if s > cmax then cmax:= s; Counts(s):= 1;
else Counts[s]:= Counts[s]+1;
fi;
vmax:= max[index](Counts):
if max(Counts[1..vmax-1]) = Counts[vmax] or max(Counts[vmax+1..-1])=Counts[vmax] then A[i]:= 0 else A[i]:= vmax fi
od:
seq(A[i], i=1..N); # Robert Israel, Jun 12 2018
MATHEMATICA
Block[{c = Select[Range@ 120, CompositeQ], s}, s = DivisorSigma[1, c]; Array[If[Length@ # == 1, #[[1, 1]], 0] &@ Last@ SplitBy[SortBy[Tally@ Take[s, #], Last], Last] &, Length@ s]] (* Michael De Vlieger, Jun 14 2018 *)
PROG
(PARI) add_sigma(vec, val) = if(val > #vec, vec=concat(vec, vector(val-#vec))); vec[val]++; vec
max_pos(vec) = if(#setintersect(vecsort(vec), vector(#vec, t, vecmax(vec))) > 1, return(0), for(k=1, #vec, if(vec[k]==vecmax(vec), return(k))))
terms(n) = my(sig=[], i=0); forcomposite(c=1, , sig=add_sigma(sig, sigma(c)); print1(max_pos(sig), ", "); i++; if(i==n, break))
terms(100) \\ Print initial 100 terms of the sequence
CROSSREFS
KEYWORD
nonn,look
AUTHOR
Felix Fröhlich, Jun 08 2018
STATUS
approved