login

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

If n is prime, a(n) is next composite greater than a(n-1), else if n is composite, a(n) is next prime greater than a(n-1) else 2.
1

%I #4 Mar 30 2012 18:52:12

%S 2,4,6,7,8,11,12,13,17,19,20,23,24,29,31,37,38,41,42,43

%N If n is prime, a(n) is next composite greater than a(n-1), else if n is composite, a(n) is next prime greater than a(n-1) else 2.

%e 1 is not prime, a(1)=2, 2 is prime, a(2)=4, 3 is prime, a(3)=6, 4 is composite, a(4)=7.

%Y Cf. A159559

%K nonn

%O 1,1

%A _Gerald Hillier_, Jul 31 2009