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-6 of 6 results.

A068654 Prime numbers such that every cyclic permutation (other than the number itself) is composite.

Original entry on oeis.org

19, 23, 29, 41, 43, 47, 53, 59, 61, 67, 83, 89, 109, 137, 139, 151, 167, 179, 193, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 281, 283, 293, 347, 349, 353, 383, 389, 401, 409, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 487, 499, 503, 509
Offset: 1

Views

Author

Amarnath Murthy, Feb 28 2002

Keywords

Examples

			167 is a member as the two cyclic permutations other than the number itself i.e. 671 and 716 are composite.
		

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[100]],Union[PrimeQ[FromDigits/@Table[ RotateRight[ IntegerDigits[#],i],{i,IntegerLength[#]-1}]]]=={False}&] (* Harvey P. Dale, Dec 08 2012 *)

Extensions

Corrected and extended by Larry Reeves (larryr(AT)acm.org), Jun 21 2002

A262988 Number of distinct primes, including n if prime, obtained by cyclically shifting the digits of n.

Original entry on oeis.org

0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 2, 1, 0, 1, 2, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 2, 1, 0, 1, 1, 0, 2, 1, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 2, 0, 2, 1, 0, 1, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 0
Offset: 1

Views

Author

Felix Fröhlich, Oct 06 2015

Keywords

Comments

First differs from A039999 at n = 103.
Differs from A061264 iff n is a term of A004022.
a(n) = A055642(n) iff n is a term of A068652, except when n is also in A004022.

Examples

			a(1013) = 2, because of the four cyclic permutations of the digits of 1013 (1013, 131, 1310, 3101) two, namely 1013 and 131, are prime and those two primes are distinct.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{len = IntegerLength@ n, s = {n}}, Do[AppendTo[s, FromDigits@ RotateRight@ IntegerDigits@ s[[k - 1]]], {k, 2, len}]; DeleteDuplicates@ Select[s, PrimeQ]]; Array[ Length@ f@ # &, {87}] (* Michael De Vlieger, Oct 07 2015 *)
  • PARI
    rot(n) = if(#Str(n)==1, v=vector(1), v=vector(#n-1)); for(i=2, #n, v[i-1]=n[i]); u=vector(#n); for(i=1, #n, u[i]=n[i]); v=concat(v, u[1]); v
    eva(n) = x=0; for(k=1, #n, x=x+(n[k]*10^(#n-k))); x
    a(n) = i=0; r=rot(digits(n)); while(r!=digits(n), if(ispseudoprime(eva(r)), i++); r=rot(r)); if(ispseudoprime(eva(r)), i++); i

A224400 Composite numbers that become prime when their digits are put in nondecreasing order.

Original entry on oeis.org

20, 30, 32, 50, 70, 74, 76, 91, 92, 95, 98, 110, 130, 170, 172, 175, 176, 190, 194, 200, 203, 209, 217, 230, 232, 272, 275, 290, 292, 296, 300, 301, 302, 310, 319, 320, 322, 323, 329, 332, 370, 371, 374, 376, 391, 392, 394, 395, 398, 407, 437, 470, 473, 475
Offset: 1

Views

Author

Keywords

Comments

Conjecture: a(n) ~ 7.75*n.

Examples

			217 = 7*31, but 127 is prime. 302 = 2*151, but 23 is prime.
		

Crossrefs

Subset of A007935.

Programs

  • Mathematica
    Select[Range[500], ! PrimeQ[#] && PrimeQ[FromDigits[Sort[IntegerDigits[#]]]] &] (* T. D. Noe, Apr 05 2013 *)
  • R
    j=1; y=c(); library(gmp)
    while(length(y)<1000) {
    if(isprime((j=j+1))==0) {
    x=sort(as.numeric(strsplit(as.character(j),spl="")[[1]]))
    if(isprime(paste(x[x>0],collapse=""))>0) y=c(y,j) #drop leading zeros
    }
    }

A224402 Composite numbers that become prime when their digits are put in nonincreasing order.

Original entry on oeis.org

14, 16, 34, 35, 38, 112, 118, 119, 121, 124, 125, 128, 133, 134, 136, 142, 143, 145, 146, 152, 154, 164, 166, 175, 176, 182, 188, 194, 214, 215, 218, 314, 316, 334, 341, 343, 344, 346, 356, 358, 361, 364, 365, 368, 374, 377, 385, 386, 388, 395, 398, 412, 413
Offset: 1

Views

Author

Keywords

Comments

Because any number ending in zero is composite, the sequence experiences gaps of at least order O(a(n))-1 between changes in the most significant digit.

Examples

			194=2*97, but 941 is prime.
		

Crossrefs

Subset of A007935.

Programs

  • Mathematica
    Select[Range[500], ! PrimeQ[#] && PrimeQ[FromDigits[Reverse[Sort[IntegerDigits[#]]]]] &] (* T. D. Noe, Apr 05 2013 *)
  • R
    j=1; y=c(); library(gmp)
    while(length(y)<1000) {
    if(isprime((j=j+1))==0) {
    x=sort(as.numeric(strsplit(as.character(j),spl="")[[1]]),decr=T)
    if(isprime(paste(x,collapse=""))>0) y=c(y,j)
    }
    }

A305885 Zeroless composite numbers which become and remain prime under a complete cyclic shift of digits.

Original entry on oeis.org

14, 16, 32, 34, 35, 38, 74, 76, 91, 92, 95, 98, 118, 119, 133, 176, 194, 316, 398, 712, 715, 731, 736, 772, 775, 778, 779, 793, 794, 914, 935, 973, 1118, 1195, 1312, 1336, 1774, 1937, 3112, 3199, 3337, 3379, 3394, 3772, 3992, 7132, 7198, 7318, 7376, 7771, 7912
Offset: 1

Views

Author

Philip Mizzi, Jun 13 2018

Keywords

Comments

Numbers with a zero digit have been excluded as cycling through these numbers would generate leading zeros, which become problematic throughout the cycle.
3999131, 7919777, 37177739 and 391331191 are in this sequence, see the link. - Eric Chen, Jun 14 2018
The sequence contains all composites without the digit zero that can be obtained by cyclically permuting the digits of the terms of A270083. - Felix Fröhlich, Jul 10 2018

Examples

			N_0 = 1118 (composite);
N_1 = 1181 (prime);
N_2 = 1811 (prime);
N_3 = 8111 (prime);
N_4 = N_0 = 1118 (composite).
		

Crossrefs

Programs

  • Maple
    Q[1]:= [seq([i],i=1..9)]:
    for d from 2 to 7 do Q[d]:= map(t -> seq([i,op(t)],i=1..9),Q[d-1]) od:
    Res:= NULL: count:= 0:
    for d from 2 to 7 do
      for q in Q[d] do P[q]:= isprime(add(q[i]*10^(i-1),i=1..d)) od;
      for q in Q[d] do
         if (not P[q]) and andmap(t -> P[ListTools:-Rotate(q,t)],[$1..d-1]) then
           count:= count+1;
           Res:= Res, add(q[i]*10^(i-1),i=1..d);
         fi
      od
    od:
    Res; # Robert Israel, Jul 10 2018
  • Mathematica
    Select[Range[11, 8000], Function[{k, d}, And[CompositeQ@ k, FreeQ[d, 0], AllTrue[Array[FromDigits@ RotateLeft[d, #] &, IntegerLength@ k - 1], PrimeQ]]] @@ {#, IntegerDigits@ #} &] (* Michael De Vlieger, Jun 14 2018 *)
  • PARI
    eva(n) = subst(Pol(n), x, 10)
    rot(n) = if(#Str(n)==1, v=vector(1), v=vector(#n-1)); for(i=2, #n, v[i-1]=n[i]); u=vector(#n); for(i=1, #n, u[i]=n[i]); v=concat(v, u[1]); v
    is(n) = my(d=digits(n), r=rot(d)); if(vecmin(d)==0, return(0), while(1, if(!ispseudoprime(eva(r)), return(0)); r=rot(r); if(r==d, return(1))))
    forcomposite(c=1, 8000, if(is(c), print1(c, ", "))) \\ Felix Fröhlich, Jul 10 2018

Formula

{ A052382 } intersection { A068653 }.
{ A068653 } minus { A011540 }.

A225193 Composite numbers such that every non-identity permutation gives a prime.

Original entry on oeis.org

14, 16, 20, 30, 32, 34, 35, 38, 50, 70, 74, 76, 91, 92, 95, 98, 110, 118, 119, 133, 772, 775, 778, 779, 1118, 3337, 7771, 77779
Offset: 1

Views

Author

Jayanta Basu, May 01 2013

Keywords

Examples

			772 is a member since both 727 and 277 are primes.
		

Crossrefs

Programs

  • Mathematica
    t={}; Do[p=Permutations[IntegerDigits[n]]; c=Length[p]; cn=Length[Select[Table[FromDigits[k],{k,p}], PrimeQ]]; If[!PrimeQ[n] && c>1 && cn==c-1, AppendTo[t,n]], {n,10,100000}]; t
  • 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 not isprime(k) and all((t:=int("".join(m)))==k or isprime(t) for m in permutations(s)))
    print(list(islice(agen(), 28))) # Michael S. Branicky, Dec 29 2023
Showing 1-6 of 6 results.