OFFSET
1,7
COMMENTS
For numbers > 1, iterate the map x -> A252463(x) which divides even numbers by 2 and shifts every prime in the prime factorization of odd n one index step towards smaller primes. a(n) counts the numbers of the form 4k+3 encountered until 1 has been reached. The count includes also n itself if it is of the form 4k+3 (A004767).
In other words, locate the node which contains n in binary tree A005940 and traverse from that node towards the root, counting all numbers of the form 4k+3 that occur on the path.
LINKS
FORMULA
MATHEMATICA
a[1] = 0; a[n_] := a[n] = 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]] + Boole[Mod[n, 4] == 3]; Array[a, 105]
PROG
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Sep 17 2017
STATUS
approved