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”).

A135679
a(n) = n if n = 1 or if n is prime. Otherwise, a(n) = 2 if n is even and a(n) = 3 if n is odd.
5
1, 2, 3, 2, 5, 2, 7, 2, 3, 2, 11, 2, 13, 2, 3, 2, 17, 2, 19, 2, 3, 2, 23, 2, 3, 2, 3, 2, 29, 2, 31, 2, 3, 2, 3, 2, 37, 2, 3, 2, 41, 2, 43, 2, 3, 2, 47, 2, 3, 2, 3, 2, 53, 2, 3, 2, 3, 2, 59, 2, 61, 2, 3, 2, 3, 2, 67, 2, 3, 2, 71, 2, 73
OFFSET
1,2
COMMENTS
The average value of a(n) is n/(2 log n) + O(n log log n/log^2 n). - Charles R Greathouse IV, May 29 2014
LINKS
MATHEMATICA
a[n_] := If[PrimeQ[n] || n == 1, n, If[EvenQ[n], 2, 3] ]; Table[a[n], {n, 1, 25}] (* G. C. Greubel, Oct 26 2016 *)
PROG
(PARI) a(n)=if(isprime(n)||n==1, n, if(n%2, 3, 2)) \\ Charles R Greathouse IV, May 29 2014
CROSSREFS
Sequence in context: A086286 A272565 A378157 * A092028 A020639 A092067
KEYWORD
nonn,easy
AUTHOR
Mohammad K. Azarian, Dec 01 2007
STATUS
approved