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.

A111348 Numbers n such that the result of swapping the 3rd and next to the next to the last digit of a number is prime.

Original entry on oeis.org

101, 104, 106, 107, 110, 112, 113, 118, 119, 124, 125, 128, 130, 131, 133, 134, 136, 140, 142, 145, 146, 149, 151, 152, 157, 160, 164, 166, 167, 170, 172, 175, 179, 181, 182, 188, 191, 194, 196, 199, 200, 300, 301, 305, 310, 311, 313, 316, 320, 322, 325
Offset: 1

Views

Author

Cino Hilliard, Nov 05 2005

Keywords

Comments

Similar to A095179 for the first few terms.
Since these numbers are just digit permutations of the primes the sequence is obviously infinite. - Charles R Greathouse IV, Oct 20 2008

Crossrefs

Programs

  • PARI
    swapn(n,d) = \ d is the digit position to swap { local(j,ln,x,s,y,y2,tmp); for(x=10^(d-1),10^(d-1)+n, s = Str(x); ln = length(s); y = eval(Vec(s)); tmp=y[d]; y[d]=y[ln-d+1]; y[ln-d+1]=tmp; y2=0; for(j=1,ln, y2+=y[j]*10^(ln-j); ); if(isprime(y2),print1(x",")) ) }

Formula

For N1=a(n)*10^n+a(n-1)*10^(n-1)+a(n-2)*10^(n-2)+...+a(2)*10^2+a(1)*10 + a(0), N2=a(n)*10^n+a(n-1)*10^(n-1)+a(2)*10^(n-2)+...+a(n-2)*10^2+a(1)*10 + a(0) is prime.

A111349 Numbers n such that the result of swapping the 4th digit and the digit 3 positions from the last digit is prime.

Original entry on oeis.org

1003, 1004, 1007, 1009, 1010, 1012, 1013, 1015, 1016, 1018, 1019, 1021, 1024, 1025, 1030, 1031, 1040, 1043, 1049, 1051, 1054, 1055, 1060, 1061, 1063, 1070, 1082, 1085, 1088, 1091, 1094, 1096, 1099, 1100, 1105, 1106, 1108, 1112, 1114, 1118, 1123, 1126
Offset: 1

Views

Author

Cino Hilliard, Nov 05 2005

Keywords

Comments

Leading zeros are dropped.
Since these numbers are just digit permutations of the primes the sequence is obviously infinite. - Charles R Greathouse IV, Oct 20 2008

Crossrefs

Programs

  • PARI
    swapn(n,d) = \ d is the digit position to swap { local(j,ln,x,s,y,y2,tmp); for(x=10^(d-1),10^(d-1)+n, s = Str(x); ln = length(s); y = eval(Vec(s)); tmp=y[d]; y[d]=y[ln-d+1]; y[ln-d+1]=tmp; y2=0; for(j=1,ln, y2+=y[j]*10^(ln-j); ); if(isprime(y2),print1(x",")) ) }

A272022 Look at the set of numbers obtained by permuting the digits of n in all possible ways, then remove n itself from the set. If the remaining numbers are all primes, then n is in the sequence.

Original entry on oeis.org

13, 14, 16, 17, 20, 30, 31, 32, 34, 35, 37, 38, 50, 70, 71, 73, 74, 76, 79, 91, 92, 95, 97, 98, 110, 113, 118, 119, 131, 133, 199, 311, 337, 373, 733, 772, 775, 778, 779, 919, 991, 1118, 3337, 7771, 77779
Offset: 1

Views

Author

César Eliud Lozada, Apr 18 2016

Keywords

Comments

If it exists, a(46) > 5*10^11. - Lars Blomberg, Mar 31 2018

Examples

			119 is in the sequence because every permutation of its digits excluding 119 (i.e., 191 and 911) is a prime.
11 is not in the sequence, because when 11 is removed from the set, no numbers are left.
		

Crossrefs

Cf. A003459. - Altug Alkan, Apr 18 2016

Programs

  • Maple
    lis := [];
    for n from 1 to 10000 do
      nn := convert(n, base, 10);
      pp := combinat[permute](nn);
      if nops(pp) = 1 then
        next
      end if;
      lOk := true;
      for p in pp do
        if p = nn then
          next: #exclude n
        end if;
        if `not`(isprime(convert(p, base, 10, 10^nops(p))[])) then
          lOk := false; break
        end if
      end do;
      if lOk then
        lis := [op(lis), n]
      end if
    end do:
    lis := lis;
  • Mathematica
    rnapQ[n_]:=Module[{p=Rest[FromDigits/@Permutations[IntegerDigits[ n]]]},If[ Length[p]==0, False, AllTrue[p,PrimeQ]]]; Select[Range[80000],rnapQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Jan 24 2019 *)
  • PARI
    isok(n) = {v = []; d = digits(n); for (k=0, (#d)!-1, p = numtoperm(#d, k); dp = vector(#d, j, d[p[j]]); np = subst(Pol(dp), x, 10); v = Set(concat(v, np));); v = setminus(v, Set(n)); if (#v == 0, return (0)); for (k=1, #v, if (!isprime(v[k]), return (0));); return (1);} \\ Michel Marcus, Apr 18 2016
    
  • Python
    from sympy import isprime
    from itertools import count, islice, permutations
    def agen(): yield from (k for k in count(1) if len(set(s:=str(k)))!=1 and all((t:=int("".join(m)))==k or isprime(t) for m in permutations(s)))
    print(list(islice(agen(), 45))) # Michael S. Branicky, Dec 29 2023
Showing 1-3 of 3 results.