A374754 a(n) is the difference between the sum of the squares and the sum of the cubes for the n first terms of A002760.
0, 0, 4, -4, 5, 21, 46, 19, 55, 104, 104, 185, 285, 406, 281, 425, 594, 790, 574, 799, 1055, 1344, 1668, 1325, 1686, 2086, 2527, 3011, 2499, 3028, 3604, 4229, 4905, 4905, 5689, 6530, 7430, 8391, 7391, 8415, 9504, 10660, 11885, 13181, 11850, 13219, 14663, 16184
Offset: 1
Keywords
Examples
a(7) = a(6) + A002760(7) = 21 + 1*25 = 46, since 25 is a square but not a cube. a(8) = a(7) - A002760(8) = 46 + (-1)*27 = 19, since 27 is a cube but not a square. a(11) = a(10) + A002760(11) - A002760(11) = 104 + 0*64 = 104, since 64 is a square and a cube. The difference between the sum of the squares and the sum of the cubes in the first 24 nonnegative integers is a(6) = 21, because A002760(6) = 16 <= 24 < A002760(7) = 25.
Links
- Felix Huber, Table of n, a(n) for n = 1..10000
Crossrefs
Programs
-
Maple
isA374754:=proc(k) option remember; if k=0 then 0 elif issqr(k) and not type(root(k,3),integer) then procname(k-1)+k; elif type(root(k,3),integer) and not issqr(k) then procname(k-1)-k; else procname(k-1) fi; end proc; A374754:=k-> if k=0 then 0 elif isA374754(k)<>isA374754(k-1) or type(root(k,6),integer) then isA374754(k) fi; seq(A374754(k),k=0..1521);
-
PARI
lista(nn) = my(v = select(x->issquare(x) || ispower(x, 3), [0..nn]), s=0, w = vector(#v)); for (i=1, #v, if (issquare(v[i]), s += v[i]); if (ispower(v[i], 3), s -= v[i]); w[i] = s;); w; \\ Michel Marcus, Aug 04 2024
-
Python
from math import isqrt from sympy import integer_nthroot def A374754(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 a*(a+1)*((a<<1)+1)//3-((b*(b+1))**2>>1)>>1 # Chai Wah Wu, Aug 09 2024
Comments