%I #6 May 03 2014 11:55:41
%S 1,2,3,7,5,11,7,11,11,13,11,17,13,17,17,19,17,23,19,23,23,29,23,29,29,
%T 29,29,31,29,37,31,37,37,37,37,41,37,41,41,43,41,47,43,47,47,53,47,53,
%U 53,53,53,59,53,59,59,59,59,61,59,67,61,67,67,67,67,71
%N a(n) = n for 1 and prime numbers. For composite numbers, first prime term in sequence starting with n and each time adding smallest prime number not a divisor of the preceding term.
%e a(22) = 29 because the smallest prime number not a divisor of 22 is 3, and 22+3=25, and 25 is composite, and the smallest prime number not a divisor of 25 is 2, and 25+2=27, and 27 is composite, and the smallest prime number not a divisor of 27 is 2, and 27+2=29, a prime number.
%o (PARI) a(n) = {if ((n==1) || isprime(n), return(n)); k = n; while (! isprime(k), p = 2; while (! (k % p), p = nextprime(p+1)); k += p;); k;} \\ _Michel Marcus_, Apr 27 2014
%K nonn
%O 1,2
%A _J. Lowell_, Apr 15 2014
%E More terms from _Michel Marcus_, Apr 27 2014
|