|
|
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
(list;
graph;
refs;
listen;
history;
text;
internal format)
|
|
|
OFFSET
|
1,3
|
|
COMMENTS
|
All terms are odd.
|
|
LINKS
|
|
|
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:
|
|
MATHEMATICA
|
a[n_] := a[n] = If[n == 1, 1, Product[{p, k} = pk; a[p^k-1]-2, {pk, FactorInteger[n]}]];
|
|
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())
|
|
CROSSREFS
|
See A351462 for a similar sequence and additional comments.
|
|
KEYWORD
|
|
|
AUTHOR
|
|
|
STATUS
|
approved
|
|
|
|