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!)
A137661 a(n+1) = if a(n) is prime then (number of primes so far) else (number of nonprimes so far), a(1) = 1. 2
1, 1, 2, 1, 3, 2, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 10, 11, 9, 12, 13, 10, 14, 15, 16, 17, 11, 12, 18, 19, 13, 14, 20, 21, 22, 23, 15, 24, 25, 26, 27, 28, 29, 16, 30, 31, 17, 18, 32, 33, 34, 35, 36, 37, 19, 20, 38, 39, 40, 41, 21, 42, 43, 22, 44, 45, 46, 47, 23, 24, 48, 49, 50, 51 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,3
COMMENTS
All terms greater than 1 occur exactly twice: a(A137662(n)) = a(n).
LINKS
FORMULA
a(n+1) = A005171(a(n))*Sum(A005171(a(k)):1<=k<=n) + A010051(a(n))*Sum(A010051(a(k)):1<=k<=n).
MAPLE
A137661 := proc(n)
option remember;
if n = 1 then
1;
else
A005171(procname(n-1)) * add(A005171(procname(k)), k=1..n-1)
+A010051(procname(n-1)) * add(A010051(procname(k)), k=1..n-1)
end if;
end proc: # R. J. Mathar, Sep 27 2021
MATHEMATICA
nn = 120; k = 1; q = 1; Prepend[Array[Set[k, If[PrimeQ[k], # - q, q++]] &, nn - 1, 2], 1] (* Michael De Vlieger, Jan 14 2023 *)
CROSSREFS
Sequence in context: A346797 A029163 A196191 * A289152 A363708 A285779
KEYWORD
nonn
AUTHOR
Reinhard Zumkeller, Feb 04 2008
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 April 19 18:05 EDT 2024. Contains 371798 sequences. (Running on oeis4.)