login

Reminder: The OEIS is hiring a new managing editor, and the application deadline is January 26.

a(n) = smallest prime >= n, if 1 is counted as a prime.
5

%I #14 Jan 01 2017 15:40:57

%S 1,2,3,5,5,7,7,11,11,11,11,13,13,17,17,17,17,19,19,23,23,23,23,29,29,

%T 29,29,29,29,31,31,37,37,37,37,37,37,41,41,41,41,43,43,47,47,47,47,53,

%U 53,53,53,53,53,59,59,59,59

%N a(n) = smallest prime >= n, if 1 is counted as a prime.

%H Reinhard Zumkeller, <a href="/A159477/b159477.txt">Table of n, a(n) for n = 1..1000</a>

%F For n >= 2, a(n) = A007918(n). a(p) = p, a(c) = a(c+1), for p = primes (A000040), c = composite numbers (A002808).

%t Join[{1},NextPrime[Range[60]]] (* _Harvey P. Dale_, Jan 04 2012 *)

%o (Haskell)

%o a159477 n = a159477_list !! (n-1)

%o a159477_list = 1 : concat

%o (zipWith (\p q -> replicate (fromInteger $ (q - p)) q)

%o a008578_list $ tail a008578_list)

%o -- _Reinhard Zumkeller_, Nov 09 2011

%Y Cf. A007918, A000040, A002808.

%Y Cf. A008578.

%K nonn

%O 1,2

%A _Jaroslav Krizek_, Apr 13 2009