login
A351463
Multiplicative, with a(p^k) = a(p^k-1) - 2 for any k > 0 and p prime.
2
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, -13, -15, -5, -7, -21, -23, -25, -15, -17, -7, 15, 13, -1, -39, 7, 5, 3, 1, -25, 21, 7, 5, -57, -59, -1, -51, -65, -67, 15, -35, -1, -3, 7, 5, -105, -107, 23, -3, -5
OFFSET
1,3
COMMENTS
All terms are odd.
EXAMPLE
a(1) = 1 (as this sequence is multiplicative).
a(2) = a(1) - 2 = -1.
a(3) = a(2) - 2 = -3.
a(7) = a(6) - 2 = a(2)*a(3) - 2 = 1.
a(42) = a(2)*a(3)*a(7) = 3.
MAPLE
a:= proc(n) option remember;
mul(a(i[1]^i[2]-1)-2, i=ifactors(n)[2])
end:
seq(a(n), n=1..64); # Alois P. Heinz, Feb 13 2022
MATHEMATICA
a[n_] := a[n] = If[n == 1, 1, Product[{p, k} = pk; a[p^k-1]-2, {pk, FactorInteger[n]}]];
Table[a[n], {n, 1, 64}] (* Jean-François Alcover, May 08 2022 *)
PROG
(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]))) }
(Python)
from math import prod
from sympy import factorint
from functools import cache
@cache
def a(n):
if n == 1: return 1
return prod(a(p**k-1)-2 for p, k in factorint(n).items())
print([a(n) for n in range(1, 65)]) # Michael S. Branicky, Feb 13 2022
CROSSREFS
See A351462 for a similar sequence and additional comments.
Sequence in context: A369800 A367291 A367289 * A121573 A196407 A156030
KEYWORD
sign,look,mult
AUTHOR
Rémy Sigrist, Feb 11 2022
STATUS
approved