login

Year-end appeal: Please make a donation to the OEIS Foundation to support ongoing development and maintenance of the OEIS. We are now in our 61st year, we have over 378,000 sequences, and we’ve reached 11,000 citations (which often say “discovered thanks to the OEIS”).

a(n) = gcd(n, A005940(n)).
8

%I #14 Jul 28 2023 15:53:03

%S 1,2,3,4,5,6,1,8,1,10,1,12,1,2,3,16,1,2,1,20,7,2,1,24,1,2,3,4,1,6,1,

%T 32,1,2,1,4,1,2,3,40,1,14,1,4,5,2,1,48,1,2,3,4,1,6,5,8,1,2,1,12,1,2,9,

%U 64,1,2,1,4,1,2,1,8,1,2,15,4,11,6,1,80,1,2,1,28,5,2,3,8,1,10,7,4,1,2,5,96,1,2,33,4

%N a(n) = gcd(n, A005940(n)).

%H Antti Karttunen, <a href="/A364500/b364500.txt">Table of n, a(n) for n = 1..16384</a>

%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>

%F a(n) = gcd(n, A364499(n)) = gcd(A005940(n), A364499(n)).

%F a(n) = n / A364501(n) = A005940(n) / A364502(n).

%t nn = 100; Array[Set[a[#], #] &, 2]; Do[If[EvenQ[n], Set[a[n], 2 a[n/2]], Set[a[n], Times @@ Power @@@ Map[{Prime[PrimePi[#1] + 1], #2} & @@ # &, FactorInteger[a[(n + 1)/2]]]]], {n, 3, nn}]; Array[GCD[a[#], #] &, nn] (* _Michael De Vlieger_, Jul 28 2023 *)

%o (PARI)

%o A005940(n) = { my(p=2, t=1); n--; until(!n\=2, if((n%2), (t*=p), p=nextprime(p+1))); t };

%o A364500(n) = gcd(n, A005940(n));

%o (PARI) A364500(n) = { my(orgn=n,p=2,rl=0,z=1); n--; while(n, if(!(n%2), p=nextprime(1+p), rl++; if(1==(n%4), z *= p^min(rl,valuation(orgn,p)); rl=0)); n>>=1); (z); };

%Y Cf. A005940, A364499, A364501, A364502.

%Y Cf. also A324198, A339969, A364255.

%K nonn

%O 1,2

%A _Antti Karttunen_, Jul 28 2023