login
A326119
a(n) is the absolute value of the alternating sum of the first n increasing perfect powers (A001597): 1, 1-4, 1-4+8, 1-4+8-9, ...
0
1, 3, 5, 4, 12, 13, 14, 18, 18, 31, 33, 48, 52, 69, 56, 72, 72, 97, 99, 117, 108, 135, 121, 168, 156, 187, 174, 226, 215, 269, 243, 286, 290, 335, 341, 388, 396, 445, 455, 506, 494, 530, 559, 597, 628, 668, 663, 706, 738, 783, 817, 864, 864, 900, 949, 987, 1038
OFFSET
1,2
FORMULA
a(n) = abs(Sum_{k=1..n} (-1)^k*A001597(k)). - Andrew Howroyd, Sep 10 2019
EXAMPLE
For n=8: a(8) = |1 - 4 + 8 - 9 + 16 - 25 + 27 - 32|.
MATHEMATICA
t = Select[Range@2400, # == 1 || GCD @@ Last /@ FactorInteger@# > 1 &]; Abs@ Accumulate[t (-1)^Range@ Length[t]] (* Giovanni Resta, Sep 11 2019 *)
PROG
(PARI) seq(n)={my(v=vector(n), i=0, k=0, s=0); while(i<#v, k++; if(ispower(k)||k==1, s=k-s; i++; v[i]=abs(s))); v} \\ Andrew Howroyd, Sep 10 2019
CROSSREFS
Sequence in context: A376817 A127397 A284048 * A201271 A324779 A167808
KEYWORD
nonn
AUTHOR
STATUS
approved