OFFSET
1,3
LINKS
FORMULA
a(1) = 0; for n > 1, a(n) = 2*a(A252463(n)) + [n == 2 (mod 4)], where the last part of the formula is Iverson bracket, giving 1 only if n is of the form 4k+2, and 0 otherwise.
Other identities. For n >= 1:
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] == 2, 1, 0], 2], {n, 77}] (* 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)};
(PARI) a(n) = my(m=factor(n), k=-2); sum(i=1, matsize(m)[1], 1 << (primepi(m[i, 1]) + (k+=m[i, 2]))); \\ Kevin Ryde, Dec 11 2020
(Python)
from sympy.core.cache import cacheit
from sympy.ntheory.factor_ import digits
from sympy import factorint, prevprime
from operator import mul
from functools import reduce
def a292372(n):
k=digits(n, 4)[1:]
return 0 if n==0 else int("".join(['1' if i==2 else '0' for i in k]), 2)
def a064989(n):
f=factorint(n)
return 1 if n==1 else reduce(mul, [1 if i==2 else prevprime(i)**f[i] for i in f])
def a252463(n): return 1 if n==1 else n//2 if n%2==0 else a064989(n)
@cacheit
def a292384(n): return 1 if n==1 else 4*a292384(a252463(n)) + n%4
def a(n): return a292372(a292384(n))
print([a(n) for n in range(1, 111)]) # Indranil Ghosh, Sep 21 2017
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Sep 15 2017
STATUS
approved