login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

A351462
Multiplicative, with a(p^k) = a(p^k-1) + 2 for any k > 0 and p prime.
2
1, 3, 5, 7, 9, 15, 17, 19, 21, 27, 29, 35, 37, 51, 45, 47, 49, 63, 65, 63, 85, 87, 89, 95, 97, 111, 113, 119, 121, 135, 137, 139, 145, 147, 153, 147, 149, 195, 185, 171, 173, 255, 257, 203, 189, 267, 269, 235, 237, 291, 245, 259, 261, 339, 261, 323, 325, 363
OFFSET
1,2
COMMENTS
All terms are odd.
Changing the parameter "2" in the name to:
- 0 gives the all 1's sequence (A000012),
- 1 gives the positive integers (A000027),
- -2 gives A351463.
EXAMPLE
a(1) = 1 (as this sequence is multiplicative).
a(2) = a(1) + 2 = 3.
a(3) = a(2) + 2 = 5.
a(7) = a(6) + 2 = a(2)*a(3) + 2 = 17.
a(42) = a(2)*a(3)*a(7) = 255.
MAPLE
a:= proc(n) option remember;
mul(a(i[1]^i[2]-1)+2, i=ifactors(n)[2])
end:
seq(a(n), n=1..58); # 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, 58}] (* 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, 59)]) # Michael S. Branicky, Feb 13 2022
CROSSREFS
KEYWORD
nonn,look,mult
AUTHOR
Rémy Sigrist, Feb 11 2022
STATUS
approved