OFFSET
1,2
COMMENTS
Ordered sequence of squares and cubes is as in A002760.
LINKS
Alois P. Heinz, Table of n, a(n) for n = 1..20000
EXAMPLE
First sorted squares and cubes are: 0, 1, 4, 8, 9, 16, 25, 27, 36, 49, 64, 81, 100, hence a(1) = 1 - 0 = 1, a(10) = 64 - 49 = 15, a(12) = 100 - 81 = 19.
MATHEMATICA
Module[{nn=70, sq, cb}, sq=Range[0, nn]^2; cb=Select[Range[nn]^3, #<=sq[[-1]]&]; Join[sq, cb]//Union//Differences] (* Harvey P. Dale, Jun 11 2024 *)
PROG
(PARI) lista(nn) = {vec = vector(nn, i, i-1); pp = select(i->(issquare(i) || (ispower(i, 3))), vec); for (i=1, #pp-1, print1(pp[i+1] - pp[i], ", "); ); } \\ Michel Marcus, Oct 03 2013
(Python)
from math import isqrt
from sympy import integer_nthroot
def A075052(n):
def f(x): return n-1+x+integer_nthroot(x, 6)[0]-(b:=integer_nthroot(x, 3)[0])-(a:=isqrt(x)), a, b
m = n-1
k, a, b = f(n-1)
while m != k:
m = k
k, a, b = f(k)
return min((a+1)**2, (b+1)**3)-m # Chai Wah Wu, Aug 09 2024
CROSSREFS
KEYWORD
nonn
AUTHOR
Zak Seidov, Oct 07 2002
STATUS
approved