login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A195324 Even numbers that cannot be represented as the sum of an odd prime and a safe prime (A005385). 1

%I #15 Aug 03 2014 14:01:33

%S 2,4,6,32,56,92,98,122,128,140,152,176,194,212,224,242,254,260,272,

%T 296,302,308,326,332,368,392,398,410,422,434,452,458,476,488,500,512,

%U 518,524,536,542,560,572,596,602,632,644,656,662,674,686,692,704,710,728

%N Even numbers that cannot be represented as the sum of an odd prime and a safe prime (A005385).

%H Reinhard Zumkeller, <a href="/A195324/b195324.txt">Table of n, a(n) for n = 1..10000</a>

%H StackExchange, <a href="http://math.stackexchange.com/questions/64109/even-numbers-greater-than-6-as-sum-of-two-specific-primes/64111#64111">Even numbers greater than 6 as sum of two specific primes</a>

%t mx = 1000; safe = Select[Prime[Range[PrimePi[mx]]], PrimeQ[(# - 1)/2] &]; p = Prime[Range[2, PrimePi[mx]]]; Complement[Range[2, mx, 2], Union[Flatten[Outer[Plus, p, t]]]] (* _T. D. Noe_, Sep 15 2011 *)

%o #!/usr/bin/perl

%o $| = 1;

%o sub is_prime {

%o my $n = shift;

%o return 0 if $n < 2;

%o return 1 if $n == 2;

%o return 0 unless $n % 2;

%o my $sn = int(sqrt($n));

%o for (my $j = 3; $j <= $sn; $j += 2) {

%o return 0 if $n % $j == 0;

%o }

%o return 1;

%o }

%o my $n = 0;

%o while (1) {

%o ++$n;

%o next if $n % 2;

%o my $found = 0;

%o for my $p (3 .. $n) {

%o next unless $p % 2;

%o my $q = $n - $p;

%o next unless $q % 2;

%o next unless is_prime($p);

%o next unless is_prime($q);

%o next unless is_prime(($p - 1) / 2) || is_prime(($q - 1) / 2);

%o $found = 1;

%o last;

%o }

%o print "$n\n" unless $found;

%o }

%o (Haskell)

%o a195324 n = a195324_list !! (n-1)

%o a195324_list = filter p [2,4..] where

%o p n = all ((== 0) . a010051) $ takeWhile (> 1) $ map (n -) a005385_list

%o -- _Reinhard Zumkeller_, Sep 18 2011

%Y Cf. A000040 (primes), A005385 (safe primes).

%K nonn

%O 1,1

%A _Dan Brumleve_, Sep 15 2011

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 16 05:35 EDT 2024. Contains 371697 sequences. (Running on oeis4.)