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.

A230399 Smallest k such that when k is divided by all numbers <= k the remainder n occurs most often.

This page as a plain text file.
%I A230399 #52 Feb 06 2021 21:50:27
%S A230399 1,7,26,23,34,53,118,167,188,69,178,179,372,349,374,375,376,377,498,
%T A230399 499,356,501,502,503,1284,1285,746,747,748,749,1038,1039,1112,753,754,
%U A230399 755,2136,2137,2138,2139,2140,2141,2562,2443,1484,2445,1486,1487,2568,2569,2570,2571,2572,2573,2934,2575
%N A230399 Smallest k such that when k is divided by all numbers <= k the remainder n occurs most often.
%C A230399 Number of row in A072528 where it happens first that the n-th column contains the maximum value in the row. - _Ralf Stephan_, Oct 21 2013
%C A230399 Any nonnegative integer n is the most common remainder during dividing m by all numbers not exceeding m for infinitely many different positive integers m.
%C A230399 Ties for most common are not allowed. Thus a(1) is not 5, although 0 and 1 both occur twice among 5 mod 1 to 5 mod 5. - _Robert Israel_, May 10 2020
%C A230399 Vladimir Letsko (see Letsko Link) asks if a(2013) exists (paraphrasing his question) without asking its value. Indeed, for m = 526173 we have T(m, 2013) = 68 where 68 is the largest value of T(526173, k) for k >= 0 and T as defined in A072528. - _David A. Corneth_, May 12 2020
%H A230399 David A. Corneth, <a href="/A230399/b230399.txt">Table of n, a(n) for n = 0..10080</a> (first 468 terms from Robert Israel)
%H A230399 Vladimir Letsko, <a href="http://www-old.fizmat.vspu.ru/doku.php?id=marathon:problem_181">Mathematical Marathon, Problem 181</a> (in Russian).
%e A230399 a(1) = 7 because
%e A230399 (1) 7 mod 2 = 7 mod 3 = 7 mod 6 = 1 and the other remainders occur fewer times;
%e A230399 (2) 7 is the least number k for which r = k mod b yields the remainder r=1 for more bases b < k than any other remainder.
%p A230399 maxrem:=proc(n) local r,n1,i,mx,M,R;n1:=`if`(n mod 2 = 0, n/2-1,(n-1)/2);
%p A230399 R:=Array(0..n1,fill=1):
%p A230399 if n mod 2 = 0 then R[0]:=2 fi:
%p A230399 for i to n1 do r:=n mod i: R[r]:=R[r]+1 od:
%p A230399 mx:=R[0]:M:={0}:
%p A230399 for i to n1 do
%p A230399 if R[i]> mx then mx:=R[i]:M:={i} elif mx=R[i] then M:=M union {i} fi od:
%p A230399 M; end;
%p A230399 Rs:={0}:S:=[[0,1]]:for n to 6000 do r:=maxrem(n):if nops(r)=1 then r:=op(r):
%p A230399 if not member(r,Rs) then Rs:=Rs union {r}:S:=[op(S),[r,n]] fi fi od:
%p A230399 S:=sort(S);
%p A230399 T:=[]:for i to nops(S) do if S[i,1]=i-1 then T:=[op(T),S[i,2]] else break fi od:T;
%t A230399 a[n_] := Module[{k, rems}, For[k = 1, True, k++, rems = SortBy[Tally[Mod[k, Range[k]]], Last]; If[rems[[-1, 1]] == n && rems[[-1, 2]] != rems[[-2, 2]], Print[n, " ", k]; Return[k]]]];
%t A230399 a[0] = 1;
%t A230399 a /@ Range[0, 100] (* _Jean-François Alcover_, Jun 18 2020 *)
%o A230399 (PARI) record(n)=v=vector(n+1); for(d=1,n, t=(n%d)+1; v[t]=v[t]+1); m=0; p=0; for(i=1,n,if(v[i]>m, m=v[i]; p=i));p
%o A230399 for(n=1,100, for(j=1,10^6, if(record(j)==n, print1(j,", "); break))) \\ _Ralf Stephan_, Oct 21 2013
%Y A230399 Cf. A230374, A002182, A072528.
%K A230399 nonn,look
%O A230399 0,2
%A A230399 _Vladimir Letsko_, Oct 18 2013