login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A326440 a(n) = 1 - tau(1) + tau(2) - tau(3) + ... + (-1)^n tau(n), where tau = A000005 is number of divisors. 1
1, 0, 2, 0, 3, 1, 5, 3, 7, 4, 8, 6, 12, 10, 14, 10, 15, 13, 19, 17, 23, 19, 23, 21, 29, 26, 30, 26, 32, 30, 38, 36, 42, 38, 42, 38, 47, 45, 49, 45, 53, 51, 59, 57, 63, 57, 61, 59, 69, 66, 72, 68, 74, 72, 80, 76, 84, 80, 84, 82, 94, 92, 96, 90, 97, 93, 101, 99 (list; graph; refs; listen; history; text; internal format)
OFFSET

0,3

COMMENTS

Is this sequence nonnegative?

As tau(n) is odd when n is a square, there are alternating strings of even and odd integers with change of parity for each n square. Indeed, between m^2 and (m+1)^2-1, there is a string of 2m+1 even terms if m is odd, or a string of 2m+1 odd terms if m is even. - Bernard Schott, Jul 10 2019

LINKS

Michel Marcus, Table of n, a(n) for n = 0..5000

FORMULA

a(n) = 1 + Sum_{k=1..n} (-1)^k A000005(k).

For n > 0, a(n) = 1 + A307704(n).

If p prime, a(p) = a(p-1) - 2. - Bernard Schott, Jul 10 2019

EXAMPLE

The first 6 terms of A000005 are 1, 2, 2, 3, 2, 4, so a(6) = 1 - 1 + 2 - 2 + 3 - 2 + 4 = 5.

MATHEMATICA

Accumulate[Table[If[k==0, 1, (-1)^k*DivisorSigma[0, k]], {k, 0, 30}]]

PROG

(PARI) a(n) = 1 - sum(k=1, n, (-1)^(k+1)*numdiv(k)); \\ Michel Marcus, Jul 09 2019

(MAGMA) [1] cat [1+(&+[(-1)^(k)*#Divisors(k):k in [1..n]]):n in [1..70]]; // Marius A. Burtea, Jul 10 2019

CROSSREFS

Cf. A000005, A001222, A008683, A054519, A071321, A195017, A268387, A307704, A316523, A316524, A319273.

Sequence in context: A282892 A008798 A005290 * A166117 A078051 A130627

Adjacent sequences:  A326437 A326438 A326439 * A326441 A326442 A326443

KEYWORD

nonn

AUTHOR

Gus Wiseman, Jul 06 2019

STATUS

approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified August 12 23:52 EDT 2022. Contains 356077 sequences. (Running on oeis4.)