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.

A120847 Klarner-Rado primes. Primes in A005658.

Original entry on oeis.org

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
Offset: 1

Views

Author

Jonathan Vos Post, Aug 18 2006

Keywords

Crossrefs

Subsequence of A003627.

Programs

  • 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
    
  • 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
  • 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

Formula

A000040 INTERSECTION {sequence starting with 1 and such that if n appears so do 2n, 3n+2, 6n+3}.

Extensions

More terms from R. J. Mathar, Aug 20 2006