Skip to main content
Tweeted twitter.com/StackCodeGolf/status/1366674651288633348
Became Hot Network Question
added 97 characters in body
Source Link

Powerful numbers are positive integers such that, when expressed as a prime factorisation:

$$a = p_1^{e_1} \times p_2^{e_2} \times p_3^{e_3} \cdots \times p_k^{e_k}$$

all exponents \$e_1, e_2, ...\$ are greater than or equal to \$2\$. Note that the exponents do not include zero exponents, as exampled by \$200 = 2^3 \times 3^0\times 5^2 = 2^3 \times 5^2\$ being a powerful number. This includes all perfect powers, and a few "extra" numbers that are not perfect powers.

Achilles numbers are powerful numbers that are not perfect powers. The smallest Achilles number is \$72 = 2^3 \times 3^2\$. The Achilles numbers less than or equal to \$500\$ are \$72, 108, 200, 288, 392, 432\$ and \$500\$.

You are to take an Achilles number as input and output the smallest Achilles number greater than the input.

You may input and output in any convenient methodconvenient method. This is so the shortest code in bytes wins

Test Cases

input output
   72    108
  108    200
  200    288
  800    864
 1152   1323
 4500   4563
 3456   3528
 4563   4608
43808  43904
90828  91592
28800  29403
64800  64827
29768  30375

The program I used to generate these test cases. Contains spoilers for anyone who can understand Jelly.

Powerful numbers are positive integers such that, when expressed as a prime factorisation:

$$a = p_1^{e_1} \times p_2^{e_2} \times p_3^{e_3} \cdots \times p_k^{e_k}$$

all exponents \$e_1, e_2, ...\$ are greater than or equal to \$2\$. Note that the exponents do not include zero exponents, as exampled by \$200 = 2^3 \times 3^0\times 5^2 = 2^3 \times 5^2\$ being a powerful number. This includes all perfect powers, and a few "extra" numbers that are not perfect powers.

Achilles numbers are powerful numbers that are not perfect powers. The smallest Achilles number is \$72 = 2^3 \times 3^2\$. The Achilles numbers less than or equal to \$500\$ are \$72, 108, 200, 288, 392, 432\$ and \$500\$.

You are to take an Achilles number as input and output the smallest Achilles number greater than the input.

You may input and output in any convenient method. This is so the shortest code in bytes wins

Test Cases

input output
   72    108
  108    200
  200    288
  800    864
 1152   1323
 4500   4563
 3456   3528
 4563   4608
43808  43904
90828  91592
28800  29403
64800  64827
29768  30375

The program I used to generate these test cases. Contains spoilers for anyone who can understand Jelly.

Powerful numbers are positive integers such that, when expressed as a prime factorisation:

$$a = p_1^{e_1} \times p_2^{e_2} \times p_3^{e_3} \cdots \times p_k^{e_k}$$

all exponents \$e_1, e_2, ...\$ are greater than or equal to \$2\$. Note that the exponents do not include zero exponents, as exampled by \$200 = 2^3 \times 3^0\times 5^2 = 2^3 \times 5^2\$ being a powerful number. This includes all perfect powers, and a few "extra" numbers that are not perfect powers.

Achilles numbers are powerful numbers that are not perfect powers. The smallest Achilles number is \$72 = 2^3 \times 3^2\$. The Achilles numbers less than or equal to \$500\$ are \$72, 108, 200, 288, 392, 432\$ and \$500\$.

You are to take an Achilles number as input and output the smallest Achilles number greater than the input.

You may input and output in any convenient method. This is so the shortest code in bytes wins

Test Cases

input output
   72    108
  108    200
  200    288
  800    864
 1152   1323
 4500   4563
 3456   3528
 4563   4608
43808  43904
90828  91592
28800  29403
64800  64827
29768  30375

The program I used to generate these test cases. Contains spoilers for anyone who can understand Jelly.

Source Link

What's next, Achilles?

Powerful numbers are positive integers such that, when expressed as a prime factorisation:

$$a = p_1^{e_1} \times p_2^{e_2} \times p_3^{e_3} \cdots \times p_k^{e_k}$$

all exponents \$e_1, e_2, ...\$ are greater than or equal to \$2\$. Note that the exponents do not include zero exponents, as exampled by \$200 = 2^3 \times 3^0\times 5^2 = 2^3 \times 5^2\$ being a powerful number. This includes all perfect powers, and a few "extra" numbers that are not perfect powers.

Achilles numbers are powerful numbers that are not perfect powers. The smallest Achilles number is \$72 = 2^3 \times 3^2\$. The Achilles numbers less than or equal to \$500\$ are \$72, 108, 200, 288, 392, 432\$ and \$500\$.

You are to take an Achilles number as input and output the smallest Achilles number greater than the input.

You may input and output in any convenient method. This is so the shortest code in bytes wins

Test Cases

input output
   72    108
  108    200
  200    288
  800    864
 1152   1323
 4500   4563
 3456   3528
 4563   4608
43808  43904
90828  91592
28800  29403
64800  64827
29768  30375

The program I used to generate these test cases. Contains spoilers for anyone who can understand Jelly.