OFFSET
1,11
COMMENTS
Locate the node which contains n in binary tree A005940 and traverse towards the root (which is 1), counting separately all numbers of the form 4k+1 and of the form 4k+3 that occur on the path (including also starting n itself, if it is of the either form), until 1 is reached, which however, is never included in the count of 4k+1. a(n) is the count of 4k+3 numbers minus the count of 4k+1 numbers that were encountered.
LINKS
MATHEMATICA
a[1, 1] = 1; a[1, 3] = 0; a[n_, k_] := a[n, k] = a[Which[n == 1, 1, EvenQ@ n, n/2, True, Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ n], k] + Boole[Mod[n, 4] == k]; Array[a[#, 3] - a[#, 1] &, 105] (* Michael De Vlieger, Sep 17 2017 *)
CROSSREFS
KEYWORD
sign
AUTHOR
Antti Karttunen, Sep 17 2017
STATUS
approved