# Answer to Question #26088 in Combinatorics | Number Theory for Ritvik

Question #26088

how many integers from 1 to 19999 have exactly 15 divisors ?

Expert's answer

package divisors; import java.util.ArrayList;

import java.util.List;

public class Divisors {

public static void main(String[] args) {

int number = 19999;

int answer =countdivisor(number);

System.out.print("Answer:");

System.out.println(answer);

}

public static int countdivisor(int number) {

List<Integer> list = newArrayList();

int j = 0;

int countOfNumbers = 0;

int divisors = 0;

while (j <= number) {

divisors = 0;

for (int i = 1; i<= j; i++) {

if(j % i == 0) {

divisors++;

}

}

if (divisors ==15) {

countOfNumbers++;

list.add(j);

}

j++;

}

System.out.println("List ofnumbers:");

for (Integer i : list) {

System.out.println(i);

}

System.out.println("");

return countOfNumbers;

}

}

List of numbers:

144

324

400

784

1936

2025

2500

2704

3969

4624

5625

5776

8464

9604

9801

13456

13689

15376

16384

Answer:19

import java.util.List;

public class Divisors {

public static void main(String[] args) {

int number = 19999;

int answer =countdivisor(number);

System.out.print("Answer:");

System.out.println(answer);

}

public static int countdivisor(int number) {

List<Integer> list = newArrayList();

int j = 0;

int countOfNumbers = 0;

int divisors = 0;

while (j <= number) {

divisors = 0;

for (int i = 1; i<= j; i++) {

if(j % i == 0) {

divisors++;

}

}

if (divisors ==15) {

countOfNumbers++;

list.add(j);

}

j++;

}

System.out.println("List ofnumbers:");

for (Integer i : list) {

System.out.println(i);

}

System.out.println("");

return countOfNumbers;

}

}

List of numbers:

144

324

400

784

1936

2025

2500

2704

3969

4624

5625

5776

8464

9604

9801

13456

13689

15376

16384

Answer:19

Need a fast expert's response?

Submit orderand get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

## Comments

## Leave a comment