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.

A363992 The number of ways 2n can be expressed as the sum of an odd prime number and an odd nonprime, both of which are relatively prime to n.

This page as a plain text file.
%I A363992 #15 Aug 02 2023 12:02:18
%S A363992 0,0,1,1,1,0,1,2,1,1,2,2,1,3,3,1,6,3,1,8,4,2,6,6,3,5,7,4,8,8,2,12,7,3,
%T A363992 13,6,6,11,9,4,12,12,4,13,13,3,14,14,8,17,11,7,15,15,10,14,13,7,16,18,
%U A363992 3,22,18,7,24,14,11,20,20,14,17,18,10,22,22,8
%N A363992 The number of ways 2n can be expressed as the sum of an odd prime number and an odd nonprime, both of which are relatively prime to n.
%e A363992 For n=24 (2n=48), we have a(24)=3 since 48=1+47, 48=13+35, and 48=23+25. These are the only sums containing one prime and one nonprime, both of which are relatively prime to n.
%p A363992 f:= proc(n) local k;
%p A363992    nops(select(k -> igcd(n,k) = 1 and igcd(n,2*n-k) = 1 and isprime(k) and not isprime(2*n-k), [seq(k,k=1..2*n-1,2)]))
%p A363992 end proc:
%p A363992 map(f, [$0..100]); # _Robert Israel_, Jul 03 2023
%o A363992 (Sage)
%o A363992 def d(a):
%o A363992     """
%o A363992     This function returns the number of ways n=2a can be expressed as the sum of one prime number and an odd composite that are relatively prime to n
%o A363992     """
%o A363992     d=0
%o A363992     for i in range(1,a+1):
%o A363992         if ((is_prime(i) and not is_prime(2*a-i) and gcd(i,2*a-i) == 1)) or ((not is_prime(i) and is_prime(2*a-i) and gcd(i,2*a-i) == 1)):
%o A363992             d=d+1
%o A363992     return d
%Y A363992 Cf. A002375, A141095.
%K A363992 nonn
%O A363992 0,8
%A A363992 _Brian Darrow, Jr._, Jun 30 2023