login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A348396 Number of ways to reach n by starting with 1 and repeatedly adding any positive integer or multiplying by any integer greater than 1. 2
1, 2, 4, 10, 18, 42, 78, 168, 328, 672, 1324, 2706, 5354, 10788, 21518, 43194, 86208, 172792, 345208, 691118, 1381616, 2764476, 5527626, 11058184, 22113454, 44232246, 88459468, 176929482, 353848086, 707718428, 1415414600, 2830872574, 5661703102, 11323491086 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,2
LINKS
EXAMPLE
For n = 3 the a(3) = 4 solutions are 1 + 2, (1 + 1) + 1, (1*2) + 1, 1*3.
MAPLE
a:= proc(n) option remember; uses numtheory; `if`(n=1, 1,
add(a(n-j), j=1..n-1)+add(a(n/d), d=divisors(n) minus {1}))
end:
seq(a(n), n=1..34); # _Alois P. Heinz_, Jan 25 2022
MATHEMATICA
a[n_] := a[n] = If[n == 1, 1, Sum[a[n - j], {j, 1, n - 1}] +
Sum[a[n/d], {d, Divisors[n] ~Complement~ {1}}]];
Table[a[n], {n, 1, 34}] (* _Jean-François Alcover_, May 14 2022, after _Alois P. Heinz_ *)
PROG
(MATLAB) a(1)=1; for n=2:20, a(n)=sum(a(1:n-1))+sum(a(find(~rem(n, 1:n-1)))); end;
(Python)
from functools import cache
@cache
def a(n): return 1 if n == 1 else 1 + sum(a(i) for i in range(1, n)) + sum(a(i) for i in range(2, n) if n%i == 0)
print([a(n) for n in range(1, 34)]) # _Michael S. Branicky_, Jan 25 2022
(PARI) seq(n)={my(a=vector(n), s=1); a[1]=s; for(n=2, n, a[n] = s + sumdiv(n, d, a[d]); s += a[n]); a} \\ _Andrew Howroyd_, Jan 25 2022
CROSSREFS
Sequence in context: A303346 A197049 A303438 * A104723 A206140 A079162
KEYWORD
nonn,easy
AUTHOR
_Michael R Peake_, Jan 25 2022
STATUS
approved

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 3 21:06 EST 2024. Contains 370517 sequences. (Running on oeis4.)