I’m writing a program that should split a given interval $ [a,b]$ into a list of $ \sqrt{N}$ equidistant numbers:

`N = 27; a = -1; b = 1; p = 3; Range[a, b, RealAbs[b - a]/(N^(1/p) - 1)] {-1, 0, 1} `

The result should be a list that has $ N^\frac{1}{p}$ numbers, and that contains both $ a$ and $ b$ . The program works when $ N=x^p$ , where $ x$ is an integer, but fails to include $ b$ in the list when this condition is not met.

For example, when $ p=2$ and $ N$ is not a perfect square:

`Np = 10; a = -1; b = 1; p = 2; Range[a, b, RealAbs[b - a]/(Np^(1/p) - 1)] // N {-1., -0.0750494, 0.849901} `

Is there a way to specify that both ends, $ a$ and $ b$ , should be part of the list, and then equally split the interval into a total of $ \sqrt{N}$ equidistant numbers?