cp's OEIS Frontend

This is a front-end for the Online Encyclopedia of Integer Sequences, made by Christian Perfect. The idea is to provide OEIS entries in non-ancient HTML, and then to think about how they're presented visually. The source code is on GitHub.

A035532 a(n) = 2*phi(n) if n composite, or 2*phi(n) - (A000120(n)-1) if n prime, where phi = A000010, Euler's totient function, and a(1) = 1.

This page as a plain text file.
%I A035532 #45 Jul 02 2025 16:01:56
%S A035532 1,2,3,4,7,4,10,8,12,8,18,8,22,12,16,16,31,12,34,16,24,20,41,16,40,24,
%T A035532 36,24,53,16,56,32,40,32,48,24,70,36,48,32,78,24,81,40,48,44,88,32,84,
%U A035532 40,64,48,101,36,80,48,72,56,112,32,116,60,72,64,96,40,130,64,88,48,137
%N A035532 a(n) = 2*phi(n) if n composite, or 2*phi(n) - (A000120(n)-1) if n prime, where phi = A000010, Euler's totient function, and a(1) = 1.
%H A035532 Reinhard Zumkeller, <a href="/A035532/b035532.txt">Table of n, a(n) for n = 1..10000</a>
%F A035532 a(n) = 2*A000010(n) - A010051(n)*A048881(n-1), for n > 1. - _Reinhard Zumkeller_, Feb 04 2015, edited by _M. F. Hasler_, Mar 10 2018
%F A035532 For many values of n, the inverse Möbius transform of this sequence (g.f.: Sum a(n)*x^n/(1-x^n)) equals A005187, but this is not the case for composite n such that A297115(n) <> 0. The equality does hold for A297111 instead. - _Antti Karttunen_ & _M. F. Hasler_, Mar 10 2018
%t A035532 Insert[Table[If[PrimeQ[n],2*EulerPhi[n] - DigitCount[n, 2][[1]] + 1, 2*EulerPhi[n]], {n, 2, 100}], 1, 1] (* _Stefan Steinerberger_, Apr 11 2006 *)
%o A035532 (Haskell)
%o A035532 a035532 1 = 1
%o A035532 a035532 n = if a010051' n == 0 then phi2 else phi2 - a000120 n + 1
%o A035532             where phi2 = 2 * a000010 n
%o A035532 -- _Reinhard Zumkeller_, Feb 04 2015
%o A035532 (PARI) A035532(n)=2*eulerphi(n)-if(isprime(n),hammingweight(n)-1,n==1) \\ _M. F. Hasler_, Mar 10 2018
%Y A035532 Cf. A000010, A010051, A035531, A048881, A297111, A297115.
%K A035532 nonn,easy
%O A035532 1,2
%A A035532 _Daniele Parisse_
%E A035532 More terms from _James Sellers_
%E A035532 Definition amended for a(1) = 1 by _M. F. Hasler_, Mar 10 2018