%I #32 Aug 06 2023 08:19:16
%S 1,1,2,2,4,2,6,4,6,4,8,4,20,6,18,8,10,6,12,8,24,8,24,8,42,20,40,12,
%T 100,18,54,16,12,10,20,12,40,12,36,16,60,24,48,16,120,24,72,16,110,42,
%U 84,40,168,40,120,24,294,100,200,36,500,54,162,32,16,12,24,20,48,20,60,24,72,40,80,24,200,36,108,32,120,60,120
%N a(n) = A000010(A005940(1+n)).
%C Each n occurs A014197(n) times in total in this sequence.
%H Antti Karttunen, <a href="/A290077/b290077.txt">Table of n, a(n) for n = 0..16384</a>
%H <a href="/index/Bi#binary">Index entries for sequences related to binary expansion of n</a>
%F a(n) = A000010(A005940(1+n)).
%t f[n_, i_, x_]:=f[n, i, x]=Which[n==0, x, EvenQ[n], f[n/2, i + 1, x], f[(n - 1)/2, i, x Prime[i]]]; a005940[n_]:=f[n - 1, 1, 1]; Table[EulerPhi[a005940[n + 1]], {n, 0, 100}] (* _Indranil Ghosh_, Jul 20 2017 *)
%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 A290077(n) = eulerphi(A005940(1+n));
%o (PARI) A290077(n) = { my(p=2,z=1); while(n, if(!(n%2), p=nextprime(1+p), z *= (p-(1==(n%4)))); n>>=1); (z); }; \\ _Antti Karttunen_, Aug 05 2023
%o (Sage)
%o def A290077(n):
%o i = 1
%o m = 1
%o while n > 0:
%o if 0==(n%2):
%o n = n//2
%o i += 1
%o else:
%o if(1==(n%4)):
%o n = (n-1)//4
%o m *= sloane.A000040(i)-1
%o i += 1
%o else:
%o n = (n-1)//2
%o m *= sloane.A000040(i)
%o return m
%o (Scheme) (define (A290077 n) (A000010 (A005940 (+ 1 n))))
%o (Scheme) (define (A290077 n) (let loop ((n n) (m 1) (i 1)) (cond ((zero? n) m) ((even? n) (loop (/ n 2) m (+ 1 i))) ((= 1 (modulo n 4)) (loop (/ (- n 1) 4) (* m (- (A000040 i) 1)) (+ 1 i))) (else (loop (/ (- n 1) 2) (* m (A000040 i)) i))))) ;; Requires only an implementation of A000040, see for example under A083221.
%Y Cf. A000010, A000040, A005940, A014197, A290076, A323915, A324052, A324054, A364568.
%K nonn
%O 0,3
%A _Antti Karttunen_, Jul 19 2017