%I #22 Aug 04 2018 14:44:22
%S 7,0,0,0,0,0,0,24,24,24,24,24,24,24,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
%T 0,0,0,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,72,0,
%U 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
%N Most common value of sigma (A000203) among all composites (A073255) up to composite(n) = A002808(n) inclusive, or 0 if there is a tie.
%e In the following table, column A lists the n-th composite and column B lists sigma(A(n)).
%e n | A | B | a(n)
%e ---------------------
%e 1 | 4 | 7 | 7
%e 2 | 6 | 12 | 0
%e 3 | 8 | 15 | 0
%e 4 | 9 | 13 | 0
%e 5 | 10 | 18 | 0
%e 6 | 12 | 28 | 0
%e 7 | 14 | 24 | 0
%e 8 | 15 | 24 | 24 <--- first time a value of sigma occurs twice
%e 9 | 16 | 31 | 24
%e 10 | 18 | 39 | 24
%e 11 | 20 | 42 | 24
%e 12 | 21 | 32 | 24
%e 13 | 22 | 36 | 24
%e 14 | 24 | 60 | 24
%e 15 | 25 | 31 | 0 <--- second time a value of sigma occurs twice
%e 16 | 26 | 42 | 0
%e 17 | 27 | 40 | 0
%e 18 | 28 | 56 | 0
%e 19 | 30 | 72 | 0
%e 20 | 32 | 63 | 0
%e 21 | 33 | 48 | 0
%e 22 | 34 | 54 | 0
%e 23 | 35 | 48 | 0
%e 24 | 36 | 91 | 0
%e 25 | 38 | 60 | 0
%e 26 | 39 | 56 | 0
%e 27 | 40 | 90 | 0
%e 28 | 42 | 96 | 0
%e 29 | 44 | 84 | 0
%e 30 | 45 | 78 | 0
%e 31 | 46 | 72 | 0
%e 32 | 48 | 124 | 0
%e 33 | 49 | 57 | 0
%e 34 | 50 | 93 | 0
%e 35 | 51 | 72 | 72 <--- first time a value of sigma occurs three times
%e 36 | 52 | 98 | 72
%e 37 | 54 | 120 | 72
%e 38 | 55 | 72 | 72 <--- fourth occurrence of the value 72
%e 39 | 56 | 120 | 72
%e 40 | 57 | 80 | 72
%e 41 | 58 | 90 | 72
%e 42 | 60 | 168 | 72
%e 43 | 62 | 96 | 72
%e 44 | 63 | 104 | 72
%e 45 | 64 | 127 | 72
%e 46 | 65 | 84 | 72
%e 47 | 66 | 144 | 72
%e 48 | 68 | 126 | 72
%e 49 | 69 | 96 | 72
%e 50 | 70 | 144 | 72
%e 51 | 72 | 195 | 72
%e 52 | 74 | 114 | 72
%e 53 | 75 | 124 | 72
%e 54 | 76 | 140 | 72
%e 55 | 77 | 96 | 0 <--- another value apart from 72 occurs four times
%e 56 | 78 | 168 | 0
%p N:= 100: # to get a(1)..a(N)
%p cmax:= 3*N: Counts:= Vector(cmax):
%p i:= 0:
%p for n from 4 do
%p if isprime(n) then next fi;
%p i:= i+1;
%p if i > N then break fi;
%p s:= numtheory:-sigma(n);
%p if s > cmax then cmax:= s; Counts(s):= 1;
%p else Counts[s]:= Counts[s]+1;
%p fi;
%p vmax:= max[index](Counts):
%p 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
%p od:
%p seq(A[i],i=1..N); # _Robert Israel_, Jun 12 2018
%t 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 *)
%o (PARI) add_sigma(vec, val) = if(val > #vec, vec=concat(vec, vector(val-#vec))); vec[val]++; vec
%o 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))))
%o terms(n) = my(sig=[], i=0); forcomposite(c=1, , sig=add_sigma(sig, sigma(c)); print1(max_pos(sig), ", "); i++; if(i==n, break))
%o terms(100) \\ Print initial 100 terms of the sequence
%Y Cf. A000203, A002808, A073255, A305672, A305673, A305674, A305675, A305676.
%K nonn,look
%O 1,1
%A _Felix Fröhlich_, Jun 08 2018