OFFSET
1,2
COMMENTS
a(n) encodes in its base-3 representation the succession of modulo 3 residues obtained when map x -> A253889(x), starting from x=n, is iterated down to the eventual 1.
LINKS
MATHEMATICA
f[n_] := Times @@ Power[If[# == 1, 1, NextPrime[#, -1]] & /@ First@ #, Last@ #] &@ Transpose@ FactorInteger[2 n - 1]; g[n_] := (Times @@ Power[If[# == 1, 1, NextPrime@ #] & /@ First@ #, Last@ #] + 1)/2 &@ Transpose@ FactorInteger@ n; a[1] = 1; a[n_] := a[n] = 3 a[Floor@ g[Floor[f[n]/2]]] + Mod[n, 3]; Array[a, 68] (* Michael De Vlieger, Sep 16 2017 *)
PROG
(PARI)
A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ From Michel Marcus
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)};
(Scheme, with memoization-macro definec)
CROSSREFS
KEYWORD
nonn,base
AUTHOR
Antti Karttunen, Sep 15 2017
STATUS
approved