login
a(1) = 1; for n>1, a(n) = smallest composite multiple of n if n is a prime else the smallest prime divisor of n if n is composite.
2

%I #10 Feb 06 2019 17:19:17

%S 1,4,6,2,10,2,14,2,3,2,22,2,26,2,3,2,34,2,38,2,3,2,46,2,5,2,3,2,58,2,

%T 62,2,3,2,5,2,74,2,3,2,82,2,86,2,3,2,94,2,7,2,3,2,106,2,5,2,3,2,118,2,

%U 122,2,3,2,5,2,134,2,3,2,142,2,146,2,3,2,7,2,158,2,3,2,166,2,5,2,3,2,178,2

%N a(1) = 1; for n>1, a(n) = smallest composite multiple of n if n is a prime else the smallest prime divisor of n if n is composite.

%C a(n) = 2n if n is a prime, a(2n+2) = 2.

%H Antti Karttunen, <a href="/A074828/b074828.txt">Table of n, a(n) for n = 1..20000</a>

%o (PARI) print1("1,");for(n=2,100,if(isprime(n),print1(2*n,","),print1(factor(n)[1,1],","))) (Rick L. Shepherd)

%o (PARI) A074828(n) = if(1==n,n,if(isprime(n),2*n,factor(n)[1,1])); \\ _Antti Karttunen_, Feb 06 2019

%Y Cf. A020639.

%K nonn

%O 1,2

%A _Amarnath Murthy_, Sep 13 2002

%E More terms from _Rick L. Shepherd_, Jun 07 2004

%E Entry revised by _N. J. A. Sloane_, Aug 13 2006