Number of $X$ expressible in the form $a^3 \cdot b$

164 Views Asked by At

A positive integer X is said to be a cube-loving number if it can be written as $(a^3) \cdot b$, for some positive integers $a$ and $b$ ($a>1$,$b \ge 1$). Given a positive integer $n$, determine the number of Cube-loving numbers less than or equal to $n$.

2

There are 2 best solutions below

0
On

Hint: the Cube-loving numbers are exactly those numbers divisible by $p^3$ where $p$ is a prime.

0
On

This is the live problem of the hackerrank University Code spring https://www.hackerrank.com/contests/university-codesprint-5/challenges/cube-loving-numbers. You do not suppose to ask here. Please make your effort in the contest.