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!)
A186336 Number of ways of representing n as the sum of one or more consecutive semiprimes. 2
0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 2, 0, 0, 0, 1, 2, 0, 0, 0, 2, 0, 1, 1, 0, 1, 2, 1, 0, 0, 2, 0, 0, 0, 2, 1, 1, 1, 0, 1, 3, 0, 0, 0, 2, 0, 0, 1, 1, 1, 1, 1, 2, 0, 0, 1, 1, 0, 1, 3, 1, 1, 0, 1, 0, 0, 1, 0, 1, 1, 3, 0, 0, 1, 2, 1, 1, 0, 2, 0, 1, 0, 0, 2, 1, 1, 2, 1, 1, 0, 0, 0, 2, 0, 2, 2, 2, 0, 2, 0, 0, 1, 1, 1, 0, 0, 0, 3, 2, 0, 1, 0, 1, 2, 0, 0, 2, 1, 0, 2, 1, 1 (list; graph; refs; listen; history; text; internal format)
OFFSET
0,11
LINKS
EXAMPLE
a(4) = 1: 4 = A001358(1) is the first semiprime.
a(10) = 2: 10 = A001358(1)+A001358(2) = 4+6 = A001358(4) = 10.
a(39) = 3: 39 = 6+9+10+14 = 10+14+15 = 39.
MAPLE
b:= proc(n) option remember; local k;
if n=0 then 0
else for k from b(n-1)+1
while isprime(k) or 2<>add(i[2], i=ifactors(k)[2])
do od; k
fi
end:
pis:= proc(n) option remember; local k;
if n<4 then 0
elif n=4 then 1
else k:= pis(n-1);
k +`if`(b(k+1)=n, 1 , 0)
fi
end:
ssp:= proc(i, j) option remember;
b(j) + `if`(i=j, 0, ssp(i, j-1))
end:
a:= proc(n) option remember; local i, j, cnt, s;
cnt:= 0;
j:= pis(n);
i:= j;
while i>0 do
s:= ssp(i, j);
if s<n then i:= i-1
elif s>n then j:= j-1
else cnt:= cnt+1;
i, j:= i-1, j-1
fi
od; cnt
end:
seq(a(n), n=0..200);
MATHEMATICA
nmax = 120;
sp = Select[Range[nmax], PrimeOmega[#] == 2&];
lsp = Length[sp]; Clear[a]; a[_] = 0;
Do[n = Total[sp[[i ;; j]]]; a[n] = a[n]+1, {i, 1, lsp}, {j, i, lsp}];
Table[a[n], {n, 0, nmax}] (* Jean-François Alcover, Mar 13 2019 *)
PROG
(Haskell)
a186336 n = f $ takeWhile (<= n) a001358_list where
f [] = 0
f (sp:sps) = g sp sps + f sps
g spSum [] = fromEnum (spSum == n)
g spSum (sp:sps) | spSum < n = g (sp + spSum) sps
| spSum == n = 1
| otherwise = 0
-- Reinhard Zumkeller, Feb 28 2011
CROSSREFS
Sequence in context: A332712 A079126 A339086 * A025891 A341000 A120630
KEYWORD
nonn
AUTHOR
Alois P. Heinz, Feb 18 2011
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 29 02:23 EDT 2024. Contains 371264 sequences. (Running on oeis4.)