login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

The numbers n such that during dividing n by all positive integers not exceeding n the remainder 0 occurs most often.
4

%I #19 Jul 02 2019 19:36:37

%S 1,2,3,4,6,8,10,12,15,16,18,20,24,28,30,36,40,42,45,48,54,56,60,66,70,

%T 72,78,80,84,90,96,100,102,104,105,108,112,120,126,132,138,140,144,

%U 150,156,160,168,176,180,192,198,200,204,208,210,216,224,228,234,240,252

%N The numbers n such that during dividing n by all positive integers not exceeding n the remainder 0 occurs most often.

%C A natural generalization of highly composite numbers (A002182), which is a subsequence of this sequence.

%H Ivan Neretin, <a href="/A230374/b230374.txt">Table of n, a(n) for n = 1..1000</a>

%e 8 is in the sequence because remainder 0 occurs 4 times during division 8 by 1, 2, 3, 4, 5, 6, 7, 8, that is more than other remainders.

%e 9 is not in the sequence because both remainders 0 and 1 occur 3 times during division 9 by 1, 2, 3, 4, 5, 6, 7, 8, 9.

%p rem0:=proc(n) local r,n1,i,mx,f,R;

%p n1:=`if`(n mod 2 = 0, n/2-1,(n-1)/2);

%p R:=Array(0..n1,fill=1):if n mod 2 = 0 then R[0]:=2 fi:

%p for i to n1 do r:=n mod i: R[r]:=R[r]+1 od:

%p mx:=R[0]:f:=true:

%p for i to n1 do

%p if R[i]>= mx then f:=false:break fi od:

%p f; end;

%p for n do if maxrem(n) then print(n) fi od:

%t Select[Range[256], (r = (Transpose@Tally@Mod[#, Range@#])[[2]])[[1]] > Max@Rest@r &] (* _Ivan Neretin_, Nov 13 2016 *)

%t zmoQ[n_] := Module[{r = Sort[Tally[Mod[n, Range[n]]]], mx}, mx = Select[r, #[[2]] == Max[r[[All, 2]]] &]; Length[mx] == 1 && mx[[1, 1]] == 0]; Select[ Range[300],zmoQ] (* _Harvey P. Dale_, Jul 02 2019 *)

%o (PARI) is(n)=v=vector(n+1);for(d=1,n,t=(n%d)+1;v[t]=v[t]+1);nd=v[1];for(i=2,n,if(v[i]>=nd,return(0)));1 \\ _Ralf Stephan_, Oct 21 2013

%Y Cf. A002182, A230399.

%K nonn

%O 1,2

%A _Vladimir Letsko_, Oct 17 2013