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.

A005070 Sum of primes == 1 (mod 3) dividing n.

This page as a plain text file.
%I A005070 #26 Oct 26 2023 23:16:01
%S A005070 0,0,0,0,0,0,7,0,0,0,0,0,13,7,0,0,0,0,19,0,7,0,0,0,0,13,0,7,0,0,31,0,
%T A005070 0,0,7,0,37,19,13,0,0,7,43,0,0,0,0,0,7,0,0,13,0,0,0,7,19,0,0,0,61,31,
%U A005070 7,0,13,0,67,0,0,7,0,0,73,37,0,19,7,13,79,0,0,0,0,7,0,43,0,0,0,0,20,0,31,0,19,0,97,7,0,0,0,0,103,13,7,0,0,0,109,0,37
%N A005070 Sum of primes == 1 (mod 3) dividing n.
%H A005070 Antti Karttunen, <a href="/A005070/b005070.txt">Table of n, a(n) for n = 1..10001</a>
%F A005070 Additive with a(p^e) = p if p == 1 (mod 3), 0 otherwise.
%F A005070 a(1) = 0; for n > 1, a(n) = a(A028234(n)) + A020639(n)*[A020639(n) == 1 (mod 3)]. (Here [] is the Iverson bracket, giving in this case 1 whenever the smallest prime is of the form 3k+1, and 0 otherwise.) - _Antti Karttunen_, May 12 2017
%e A005070 For n = 5, a(5) = 0 as 5 modulo 3 = 2.
%e A005070 For n = 49 = 7*7, a(49) = 7 as 7 modulo 3 = 1, and each such prime is counted only once.
%e A005070 For n = 91 = 7*13, a(91) = 7+13 = 20, as both primes are of the form 3k+1.
%e A005070 For n = 10001 = 73*137, only 73 is of the form 3k+1, thus a(10001) = 73.
%t A005070 Table[DivisorSum[n, # &, And[PrimeQ@ #, Mod[#, 3] == 1] &], {n, 111}] (* _Michael De Vlieger_, May 12 2017 *)
%t A005070 f[p_, e_] := If[Mod[p, 3] == 1, p, 0]; a[n_] := Plus @@ f @@@ FactorInteger[n]; a[1] = 0; Array[a, 100] (* _Amiram Eldar_, Jun 21 2022 *)
%o A005070 (Scheme) (define (A005070 n) (if (= 1 n) 0 (+ (if (= 1 (modulo (A020639 n) 3)) (A020639 n) 0) (A005070 (A028234 n)))))
%o A005070 (Python)
%o A005070 from sympy import factorint, primefactors
%o A005070 def a028234(n):
%o A005070     f = factorint(n)
%o A005070     m = min(f)
%o A005070     return 1 if n==1 else n/(m**f[m])
%o A005070 def a020639(n): return min(primefactors(n)) if n>1 else 1
%o A005070 def a(n): return 0 if n==1 else a(a028234(n)) + a020639(n)*(1*(a020639(n)%3==1)) # _Indranil Ghosh_, May 12 2017
%Y A005070 Cf. A020639, A028234.
%K A005070 nonn
%O A005070 1,7
%A A005070 _N. J. A. Sloane_
%E A005070 More terms and examples from _Antti Karttunen_, May 12 2017