OFFSET
0,2
LINKS
Alois P. Heinz, Table of n, a(n) for n = 0..450
FORMULA
MAPLE
b:= proc(n, i) option remember; `if`(n=0, 1, add(b(n-`if`(
i=0, j, 1), j)*ithprime(j), j=1..`if`(i=0, n, i)))
end:
a:= n-> b(n, 0):
seq(a(n), n=0..23); # Alois P. Heinz, Mar 04 2020
MATHEMATICA
b[n_, i_] := b[n, i] = If[n == 0, 1, Sum[b[n - If[i == 0, j, 1], j]* Prime[j], {j, 1, If[i == 0, n, i]}]];
a[n_] := b[n, 0];
Table[a[n], {n, 0, 23}] (* Jean-François Alcover, Jan 03 2022, after Alois P. Heinz *)
PROG
(PARI)
allocatemem(234567890);
A003961(n) = my(f = factor(n)); for (i=1, #f~, f[i, 1] = nextprime(f[i, 1]+1)); factorback(f); \\ Using code of Michel Marcus
A252737print(up_to_n) = { my(s, i=0, n=0); for(n=0, up_to_n, if(0 == n, s = 1, if(1 == n, s = 2; lev = vector(1); lev[1] = 2, oldlev = lev; lev = vector(2*length(oldlev)); s = 0; for(i = 0, (2^(n-1))-1, lev[i+1] = if((i%2), A003961(oldlev[(i\2)+1]), 2*oldlev[(i\2)+1]); s += lev[i+1]))); write("b252737.txt", n, " ", s)); };
A252737print(23); \\ Terms a(0) .. a(23) were computed with this program.
(Scheme, two alternative versions)
(define (add intfun lowlim uplim) (let sumloop ((i lowlim) (res 0)) (cond ((> i uplim) res) (else (sumloop (+ 1 i) (+ res (intfun i)))))))
(define (COMPOSE . funlist) (cond ((null? funlist) (lambda (x) x)) (else (lambda (x) ((car funlist) ((apply COMPOSE (cdr funlist)) x))))))
CROSSREFS
KEYWORD
nonn
AUTHOR
Antti Karttunen, Dec 21 2014
STATUS
approved