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.

A094044 Alternate prime and nonprime numbers not included earlier such that every concatenation of a pair of terms is a prime: a(2n) is nonprime and a(2n-1) is prime.

Original entry on oeis.org

2, 9, 7, 1, 3, 49, 19, 33, 13, 21, 11, 51, 47, 87, 31, 63, 17, 77, 23, 39, 29, 27, 41, 57, 37, 69, 59, 81, 61, 99, 67, 91, 73, 93, 43, 117, 79, 111, 71, 119, 53, 129, 83, 177, 89, 123, 113, 143, 107, 171, 103, 141, 97, 159, 157, 133, 109, 121, 139, 169, 151, 153, 137, 147
Offset: 1

Views

Author

Robert G. Wilson v, Apr 23 2004

Keywords

Comments

Conjecture: all members of A045572 are in the sequence. - Robert Israel, Oct 24 2017

Examples

			a(3)=7 => 97 is a prime but not necessarily 297 (in fact not a prime).
		

Crossrefs

Programs

  • Maple
    N:= 1000: # to get terms before the first term > N
    P, C:= selectremove(isprime, [1,$3..N]):
    dcat:= proc(x,y) 10^(1+ilog10(y))*x+y end proc:
    A[1]:= 2:
    for n from 2 do
      if n::even then
        for j from 1 to nops(C) do
          if isprime(dcat(A[n-1],C[j])) then
             A[n]:= C[j];
             C:= subsop(j=NULL,C);
             break
          fi
        od
      else
        for j from 1 to nops(P) do
          if isprime(dcat(A[n-1],P[j])) then
            A[n]:= P[j];
            P:= subsop(j=NULL,P);
            break
          fi
        od
      fi;
      if not assigned(A[n]) then break fi
    od:
    seq(A[i],i=1..n-1); # Robert Israel, Oct 24 2017
  • Mathematica
    p = Prime[ Range[ 500]]; np = Drop[ Complement[ Range[ 500], p], 1]; a[0] = 0; a[n_] := a[n] = Block[{k = 1, q = IntegerDigits[a[n - 1]]}, If[ OddQ[n], While[ !PrimeQ[ FromDigits[ Join[q, IntegerDigits[ p[[k]] ]]]], k++ ]; q = p[[k]]; p = Delete[p, k]; q, While[ !PrimeQ[ FromDigits[ Join[q, IntegerDigits[ np[[k]] ]]]], k++ ]; q = np[[k]]; np = Delete[np, k]; q]]; Table[ a[n], {n, 64}]