A078359 Number of ways to write n as sum of a positive square and a positive cube.
0, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 2, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
Offset: 1
Keywords
Examples
a(1025)=4, as 1025 = 5^2 + 10^3 = 30^2 + 5^3 = 31^2 + 4^3 = 32^2 + 1^3.
Links
- Seiichi Manyama, Table of n, a(n) for n = 1..10000
Programs
-
Maple
interface(prettyprint=0) : A078359 := proc(n) local resul,isq,icu ; resul := 0 ; icu := 1 ; while icu^3 < n do if issqr(n-icu^3) then resul := resul+1 ; fi ; icu := icu+1 ; od ; RETURN(resul) ; end: for n from 1 to 100000 do printf("%d %d ",n,A078359(n)) ; od ; # R. J. Mathar, Aug 16 2006
-
Mathematica
a[n_] := Which[r = Reduce[x > 0 && y > 0 && n == x^2 + y^3, {x, y}, Integers]; r === False, 0, r[[0]] === And, 1, r[[0]] === Or, Length[r], True, Print["error: ", r]]; Table[a[n], {n, 1, 105}] (* Jean-François Alcover, Feb 13 2018 *)
-
Python
from collections import Counter from itertools import count, takewhile, product def aupto(lim): sqs = list(takewhile(lambda x: x<=lim-1, (i**2 for i in count(1)))) cbs = list(takewhile(lambda x: x<=lim-1, (i**3 for i in count(1)))) cts = Counter(sum(p) for p in product(sqs, cbs)) return [cts[i] for i in range(1, lim+1)] print(aupto(105)) # Michael S. Branicky, May 29 2021
Formula
G.f.: (Sum_{k>=1} x^(k^2)) * (Sum_{k>=1} x^(k^3)). - Seiichi Manyama, Jun 17 2023
Comments