login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

Largest of the most frequently occurring numbers in 1-to-n multiplication cube.
4

%I #20 Jun 02 2022 10:25:55

%S 1,4,6,12,20,24,24,48,72,120,120,120,120,168,120,240,240,360,360,360,

%T 360,360,360,720,720,720,720,1008,1008,720,720,720,720,720,1680,2520,

%U 2520,2520,2520,1440,1440,2520,2520,2520,2520,2520,2520,5040,5040,5040

%N Largest of the most frequently occurring numbers in 1-to-n multiplication cube.

%H Branden Aldridge, <a href="/A057339/b057339.txt">Table of n, a(n) for n = 1..500</a>

%e M(n) is the array in which m(x,y,z)=x*y*z for x = 1 to n, y = 1 to n and z = 1 to n. In M(7), the most frequently occurring numbers are 12 and 24, each occurring 15 times. The largest of these numbers is 24, so a(7) = 24.

%o (Java)

%o public class LargestMultCube {

%o static int high, highestFrequency = 0;

%o static int[] counters;

%o public static void main(String[] args) {

%o int max=500;

%o counters = new int[max*max*max+1];

%o for(int outer=1; outer<=max; outer++) {

%o tally(outer*outer*outer, 1);

%o for(int middle=outer-1; middle>=1; middle--) {

%o tally(outer*outer*middle, 3); tally(outer*middle*middle, 3);

%o for(int inner=middle-1; inner>=1; inner--) {

%o tally(outer*middle*inner, 6); } }

%o System.out.println(outer+" "+high); } }

%o private static void tally(int number, int repeatFactor) {

%o counters[number] += repeatFactor;

%o if(counters[number] >= highestFrequency) {

%o if (counters[number] == highestFrequency)

%o if (number > high) high = number;

%o if (counters[number] > highestFrequency) {

%o highestFrequency = counters[number]; high = number; } } } }

%o // _Branden Aldridge_, Apr 15 2022

%Y Cf. A057143, A057338, A057342, A057345.

%K nonn

%O 1,2

%A _Neil Fernandez_, Aug 28 2000

%E More terms from _David W. Wilson_, Aug 28 2001