login
a(n) = 1 if n is either a prime or a perfect number, 0 otherwise.
2

%I #9 Jan 09 2019 21:21:42

%S 0,1,1,0,1,1,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,1,1,0,1,0,0,0,

%T 0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,

%U 0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0

%N a(n) = 1 if n is either a prime or a perfect number, 0 otherwise.

%C Characteristic function of A053813.

%C Differs from A323152 at positions n = 1, 120, 672, 30240, 32760, ...

%H Antti Karttunen, <a href="/A323153/b323153.txt">Table of n, a(n) for n = 1..65537</a>

%H <a href="/index/Ch#char_fns">Index entries for characteristic functions</a>

%o (PARI) A323153(n) = ((n>1)&&!(n%sumdiv(n,d,(d<n)*d)));

%Y Cf. A000040, A000396, A053813, A053814, A323152.

%K nonn

%O 1

%A _Antti Karttunen_, Jan 09 2019