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!)
A120847 Klarner-Rado primes. Primes in A005658. 1
2, 5, 17, 29, 47, 53, 83, 89, 101, 173, 191, 251, 263, 269, 281, 317, 431, 467, 479, 521, 587, 659, 809, 857, 911, 929, 947, 953, 983, 1019, 1091, 1163, 1307, 1439, 1451, 1493, 1559, 1601, 1613, 1667, 1811, 1847, 1871, 1901, 1979, 2027, 2063, 2099, 2207, 2243 (list; graph; refs; listen; history; text; internal format)
OFFSET
1,1
LINKS
R. J. Mathar and Robert Israel, Table of n, a(n) for n = 1..7948 (1..493 from Mathar)
FORMULA
A000040 INTERSECTION {sequence starting with 1 and such that if n appears so do 2n, 3n+2, 6n+3}.
MAPLE
N:= 3000: # to get all terms <= N
A:= Vector(N):
A[1]:= 1:
todo:= {1}:
while todo <> {} do
x:= todo[1];
todo:= todo[2..-1];
Y:= select(t -> (t <= N and A[t] = 0), [2*x, 3*x+2, 6*x+3]);
A[Y]:= 1;
todo:= todo union convert(Y, set);
od:
select(t -> A[t]=1 and isprime(t), [$1..N]); # Robert Israel, Jun 17 2015
PROG
(C++) #include <stdio.h> #include <iostream> #include <set> using namespace std ; bool isprime(const int n) { for(int i=2; i*i <= n ; i++) if( n %i == 0) return false ; return true ; } int main(int argc, char *argv[]) { const int anmax= 40000 ; set<int> a ; a.insert(1) ; for(int i=0; i< anmax ; i++) { if( a.count(i) ) { if( 2*i<=anmax) a.insert(2*i) ; if( 3*i+2 <= anmax) a.insert(3*i+2) ; if( 6*i+3 <= anmax) a.insert(6*i+3) ; } } int n=1 ; for(int i=2; i < anmax; i++) { if( a.count(i) && isprime(i) ) { cout << n << " " << i << endl ; n++ ; } } return 0 ; } /* R. J. Mathar, Aug 20 2006 */
(MATLAB)
N = 10^4;
A = zeros(1, N);
todo = [1];
A(1) = 1;
while numel(todo) > 0
x = todo(1);
todo = todo(2:end);
Y = [2*x, 3*x+2, 6*x+3];
Y = Y(Y <= N);
Y = Y(A(Y) == 0);
A(Y) = 1;
todo = [todo, Y];
end;
S = find(A==1);
S(isprime(S)) % Robert Israel, Jun 17 2015
(PARI) has(n)=if(n<3, return(n>0)); my(k=n%6); if(k==3, return(has(n\6))); if(k==1, return(0)); if(k==5, return(has(n\3))); if(k!=2, return(has(n/2))); has(n\3) || has(n/2)
print1(2); forprime(p=5, 1e5, if(p%3==2 && has(p\3), print1(", "p))) \\ Charles R Greathouse IV, Sep 15 2015
CROSSREFS
Subsequence of A003627.
Sequence in context: A243183 A195271 A077217 * A244085 A019353 A106882
KEYWORD
easy,nonn
AUTHOR
Jonathan Vos Post, Aug 18 2006
EXTENSIONS
More terms from R. J. Mathar, Aug 20 2006
STATUS
approved

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 February 24 07:07 EST 2024. Contains 370294 sequences. (Running on oeis4.)