OFFSET
1,5
LINKS
FORMULA
a(1) = 0; for n > 1, a(n) = 2*a(A252463(n)) + [n ≡ 3 (mod 4)], where the last part of the formula is Iverson bracket, giving 1 only if n is of the form 4k+3, and 0 otherwise.
Other identities. For n >= 1:
a(2n) = 2*a(n).
EXAMPLE
For n = 3, the starting value is of the form 4k+3, after which follows A252463(3) = 2, and A252463(2) = 1, the end point of iteration, and neither 2 nor 1 is of the form 4k+3, thus a(3) = 1*(2^0) + 0*(2^1) + 0*(2^2) = 1.
For n = 5, the starting value is not of the form 4k+3, after which follows A252463(5) = 3 (which is), continuing as before as 3 -> 2 -> 1, thus a(5) = 0*(2^0) + 1*(2^1) + 0*(2^2) + 0*(2^3) = 2.
MATHEMATICA
Table[FromDigits[Reverse@ NestWhileList[Function[k, Which[k == 1, 1, EvenQ@ k, k/2, True, Times @@ Power[Which[# == 1, 1, # == 2, 1, True, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger@ k]], n, # > 1 &] /. k_ /; IntegerQ@ k :> If[Mod[k, 4] == 3, 1, 0], 2], {n, 84}] (* Michael De Vlieger, Sep 21 2017 *)
PROG
(PARI)
A064989(n) = {my(f); f = factor(n); if((n>1 && f[1, 1]==2), f[1, 2] = 0); for (i=1, #f~, f[i, 1] = precprime(f[i, 1]-1)); factorback(f)};
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Sep 15 2017
STATUS
approved