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.

Showing 1-3 of 3 results.

A199333 Triangle read by rows: T(n,0) = T(n,n) = 1, 0 < k < n: T(n,k) = smallest prime not less than T(n-1,k) + T(n-1,k-1).

Original entry on oeis.org

1, 1, 1, 1, 2, 1, 1, 3, 3, 1, 1, 5, 7, 5, 1, 1, 7, 13, 13, 7, 1, 1, 11, 23, 29, 23, 11, 1, 1, 13, 37, 53, 53, 37, 13, 1, 1, 17, 53, 97, 107, 97, 53, 17, 1, 1, 19, 71, 151, 211, 211, 151, 71, 19, 1, 1, 23, 97, 223, 367, 431, 367, 223, 97, 23, 1, 1, 29, 127
Offset: 0

Views

Author

Reinhard Zumkeller, Nov 09 2011

Keywords

Comments

T(n,k) = T(n,n-k);
T(n,0) = 1, cf. A000012;
T(n,1) = A008578(n), n > 0;
A199424(n) = first row in triangle A199302 containing n-th prime;
A199425(n) = number of distinct primes in rows 0 through n;
large terms in the b-file are probable primes only, row number > 50.

Examples

			0:                 1
1:               1   1
2:             1   2   1
3:           1   3   3   1
4:         1   5   7   5   1
5:       1   7  13  13   7   1
6:     1  11  23  29  23  11   1
7:   1  13  37  53  53  37  13   1
8: 1  17  53  97 107  97  53  17   1
primes in 8th row:
T(7,0) + T(7,1) = 1+13 = 14 --> T(8,1) = T(8,7) = 19;
T(7,1) + T(7,2) = 13+37 = 50 --> T(8,2) = T(8,6) = 53, already in row 7;
T(7,2) + T(7,3) = 37+53 = 90 --> T(8,3) = T(8,5) = 97;
T(7,3) + T(7,4) = 53+53 = 106 --> T(8,4) = 107.
		

Crossrefs

Cf. A159477; A199581 & A199582 (central terms), A199694 (row sums), A199695 & A199696 (row products); A007318.

Programs

  • Haskell
    a199333 n k = a199333_tabl !! n !! k
    a199333_row n = a199333_tabl !! n
    a199333_list = concat a199333_tabl
    a199333_tabl = iterate
       (\row -> map a159477 $ zipWith (+) ([0] ++ row) (row ++ [0])) [1]
  • Mathematica
    T[n_, k_] := T[n, k] = Switch[k, 0|n, 1, _, With[{m = T[n-1, k] + T[n-1, k-1]}, If[PrimeQ[m], m, NextPrime[m]]]];
    Table[T[n, k], {n, 0, 13}, {k, 0, n}] // Flatten (* Jean-François Alcover, Sep 19 2021 *)

Formula

T(n,k) = A007918(T(n-1,k) + T(n-1,k-1)), 0 < k < n, T(n,0) = T(n,n) = 1.

A199303 Palindromic primes in the sense of A007500 with digits '0', '1' and '3' only.

Original entry on oeis.org

3, 11, 13, 31, 101, 113, 131, 311, 313, 1031, 1033, 1103, 1301, 3011, 3301, 10301, 10333, 11003, 11311, 13331, 30011, 30103, 31013, 31033, 33013, 33301, 101333, 110311, 113011, 113131, 131311, 133033, 133103, 301331, 301333, 330331, 333101, 333103, 1000033, 1001003, 1001303, 1003001
Offset: 1

Views

Author

M. F. Hasler, Nov 04 2011

Keywords

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(10^8) | Set(Intseq(p)) subset [0, 1, 3] and IsPrime(Seqint(Reverse(Intseq(p))))]; // Bruno Berselli, Nov 07 2011
    
  • Mathematica
    Flatten[{#,IntegerReverse[#]}&/@Select[FromDigits/@Tuples[{0,1,3},7],AllTrue[ {#,IntegerReverse[ #]},PrimeQ]&]]//Union (* Harvey P. Dale, Sep 12 2023 *)
  • PARI
    allow=Vec("013"); forprime(p=1, default(primelimit), setminus( Set( Vec( Str( p ))), allow)&next; isprime(A004086(p))&print1(p", ")) /* for illustrative purpose only: better use the code below */
    
  • PARI
    a(n=50,list=0,L=[0,1,3],needpal=1)={ for(d=1,1e9, u=vector(d,i,10^(d-i))~; forvec(v=vector(d,i,[1+(i==1&!L[1]),#L]), isprime(t=vector(d,i,L[v[i]])*u) || next; needpal & !isprime(A004086(t)) & next; list & print1(t","); n-- || return(t)))}  \\ M. F. Hasler, Nov 06 2011
    
  • Python
    from itertools import product
    from sympy import isprime
    A199303_list = [n for n in (int(''.join(s)) for s in product('013',repeat=12)) if isprime(n) and isprime(int(str(n)[::-1]))] # Chai Wah Wu, Dec 17 2015

A199304 Palindromic primes in the sense of A007500 with digits '0', '1' and '4' only.

Original entry on oeis.org

11, 101, 11411, 100411, 101141, 114001, 114041, 140411, 141101, 1004141, 1010411, 1040141, 1041041, 1100441, 1114111, 1140101, 1144441, 1401401, 1410401, 1411141, 1414001, 1440011, 1444411, 1444441, 10010411, 10011101, 10041011, 10044011
Offset: 1

Views

Author

M. F. Hasler, Nov 04 2011

Keywords

Comments

All terms start and end with the digit 1.

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(10^8) | Set(Intseq(p)) subset [0,1,4] and IsPrime(Seqint(Reverse(Intseq(p))))];  // Bruno Berselli, Nov 07 2011
  • Maple
    F:= proc(d) local A0, A4, Res, q, r;
       Res:= NULL;
       q:= (10^(d+1)-1)/9;
       for A0 in combinat:-powerset({$1..d-1}) do
         for A4 in combinat:-powerset({$1..d-1} minus A0) do
           r:= q - add(10^i,i=A0) + 3*add(10^i,i=A4);
           if isprime(r) and isprime(q - add(10^(d-i),i=A0) + 3*add(10^(d-i),i=A4)) then
              Res:= Res, r
           fi
       od od;
       Res
    end proc:
    sort([seq(F(d),d=1..7)]); # Robert Israel, May 03 2018
  • PARI
    allow=Vec("014");forprime(p=1,default(primelimit),setminus( Set( Vec(Str( p ))),allow)&next;isprime(A004086(p))&print1(p",")) /* better use the more efficient code below */
    
  • PARI
    a(n=50,list=0,L=[0,1,4],needpal=1)={ for(d=1,1e9, u=vector(d,i,10^(d-i))~; forvec(v=vector(d,i,[1+(i==1&!L[1]),#L]), isprime(t=vector(d,i,L[v[i]])*u) || next; needpal & !isprime(A004086(t)) & next; list & print1(t","); n-- || return(t)))}  \\ M. F. Hasler, Nov 06 2011
    
Showing 1-3 of 3 results.