%I #25 May 08 2022 08:44:18
%S 1,-1,-3,-5,-7,3,1,-1,-3,7,5,15,13,-1,21,19,17,3,1,35,-3,-5,-7,3,1,
%T -13,-15,-5,-7,-21,-23,-25,-15,-17,-7,15,13,-1,-39,7,5,3,1,-25,21,7,5,
%U -57,-59,-1,-51,-65,-67,15,-35,-1,-3,7,5,-105,-107,23,-3,-5
%N Multiplicative, with a(p^k) = a(p^k-1) - 2 for any k > 0 and p prime.
%C All terms are odd.
%H Rémy Sigrist, <a href="/A351463/b351463.txt">Table of n, a(n) for n = 1..10000</a>
%H Rémy Sigrist, <a href="/A351463/a351463.png">Scatterplot of the first 1000000 terms</a>
%e a(1) = 1 (as this sequence is multiplicative).
%e a(2) = a(1) - 2 = -1.
%e a(3) = a(2) - 2 = -3.
%e a(7) = a(6) - 2 = a(2)*a(3) - 2 = 1.
%e a(42) = a(2)*a(3)*a(7) = 3.
%p a:= proc(n) option remember;
%p mul(a(i[1]^i[2]-1)-2, i=ifactors(n)[2])
%p end:
%p seq(a(n), n=1..64); # _Alois P. Heinz_, Feb 13 2022
%t a[n_] := a[n] = If[n == 1, 1, Product[{p, k} = pk; a[p^k-1]-2, {pk, FactorInteger[n]}]];
%t Table[a[n], {n, 1, 64}] (* _Jean-François Alcover_, May 08 2022 *)
%o (PARI) a(n) = { my (f=factor(n)); if (#f~==1, a(n-1)-2, prod (k=1, #f~, a(f[k,1]^f[k,2]))) }
%o (Python)
%o from math import prod
%o from sympy import factorint
%o from functools import cache
%o @cache
%o def a(n):
%o if n == 1: return 1
%o return prod(a(p**k-1)-2 for p, k in factorint(n).items())
%o print([a(n) for n in range(1, 65)]) # _Michael S. Branicky_, Feb 13 2022
%Y See A351462 for a similar sequence and additional comments.
%K sign,look,mult
%O 1,3
%A _Rémy Sigrist_, Feb 11 2022