%I #24 Jan 15 2023 02:07:40
%S 1,2,6,4,10,6,14,24,18,10,22,12,26,42,30,16,34,18,38,60,42,22,46,120,
%T 50,78,54,28,58,30,62,96,66,170,70,36,74,114,78,40,82,42,86,132,90,46,
%U 94,336,98,150,102,52,106,270,110,168,114,58,118,60,122
%N a(n) = n if n+1 is prime; otherwise, a(n) = n * (smallest prime factor of n+1).
%H Alois P. Heinz, <a href="/A238642/b238642.txt">Table of n, a(n) for n = 1..10000</a>
%e a(8) = 24 because the smallest prime factor of 9 is 3 and 8*3 = 24.
%p with(numtheory):
%p a:= n-> n*`if`(isprime(n+1), 1, min(factorset(n+1)[])):
%p seq(a(n), n=1..100); # _Alois P. Heinz_, Mar 03 2014
%o (Sage)
%o q=100 #change q for more terms
%o [n if is_prime(n+1) else n*min(prime_divisors(n+1)) for n in [1..q]] # _Tom Edgar_, Mar 03 2014
%K nonn
%O 1,2
%A _J. Lowell_, Mar 01 2014
%E More terms from _Tom Edgar_, Mar 03 2014