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.

A204844 Cyclic primes that are not absolute primes (A003459).

This page as a plain text file.
%I A204844 #24 Aug 26 2018 10:38:52
%S A204844 197,719,971,1193,1931,3119,3779,7793,7937,9311,9377,11939,19391,
%T A204844 19937,37199,39119,71993,91193,93719,93911,99371,193939,199933,319993,
%U A204844 331999,391939,393919,919393,933199,939193,939391,993319,999331
%N A204844 Cyclic primes that are not absolute primes (A003459).
%C A204844 Every cyclic permutation of the digits is a prime, but there exists a non-cyclic permutation of the digits that produces a composite. [Extended by _Felix Fröhlich_, Aug 05 2018]
%C A204844 The sequence is the relative complement of A317688 in A293663. - _Felix Fröhlich_, Aug 05 2018
%C A204844 Conjecture: The sequence is finite, with 999331 being the last term (cf. A293142). - _Felix Fröhlich_, Aug 05 2018
%H A204844 J. L. Boal and J. H. Bevis, <a href="http://www.jstor.org/stable/2689862">Permutable primes</a>, Mathematics Magazine, Vol. 55, No. 1 (1982), 38-41.
%e A204844 197, 719 and 971 are terms of the sequence, because all three numbers are prime, each number can be obtained by cyclically permuting the digits of one of the other numbers and there exist some composites, namely 791 and 917, that can be obtained from non-cyclic permutations of the digits of those three numbers. - _Felix Fröhlich_, Aug 10 2018
%t A204844 Select[Prime@ Range@ PrimePi[10^6], Union[d = IntegerDigits[#], {1,3,7,9}] == {1, 3, 7, 9} && AllTrue[ RotateLeft[d, #] & /@ Range@ IntegerLength@ #, PrimeQ@ FromDigits@ # &] && AnyTrue[ FromDigits /@ Permutations[d], CompositeQ] &] (* _Giovanni Resta_, Aug 10 2018 *)
%o A204844 (PARI) eva(n) = subst(Pol(n), x, 10)
%o A204844 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
%o A204844 is_circularprime(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))))
%o A204844 find_index_a(vec) = my(r=#vec-1); while(1, if(vec[r] < vec[r+1], return(r)); r--; if(r==0, return(-1)))
%o A204844 find_index_b(r, vec) = my(s=#vec); while(1, if(vec[r] < vec[s], return(s)); s--; if(s==r, return(-1)))
%o A204844 switch_elements(vec, firstpos, secondpos) = my(g); g=vec[secondpos]; vec[secondpos]=vec[firstpos]; vec[firstpos] = g; vec
%o A204844 reverse_order(vec, r) = my(v=[], w=[]); for(x=1, r, v=concat(v, vec[x])); for(y=r+1, #vec, w=concat(w, vec[y])); w=Vecrev(w); concat(v, w)
%o A204844 next_permutation(vec) = my(r=find_index_a(vec)); if(r==-1, return(0), my(s=find_index_b(r, vec)); vec=switch_elements(vec, r, s); vec=reverse_order(vec, r)); vec
%o A204844 is_permutable_prime(n) = if(n < 10, return(1)); my(d=vecsort(digits(n))); while(1, if(!ispseudoprime(eva(d)), return(0)); d=next_permutation(d); if(d==0, return(1)))
%o A204844 forprime(p=1, , if(is_circularprime(p) && !is_permutable_prime(p), print1(p, ", "))) \\ _Felix Fröhlich_, Aug 05 2018
%Y A204844 Cf. A003459, A068652, A293142, A293663, A317688.
%K A204844 nonn,base,more
%O A204844 1,1
%A A204844 _N. J. A. Sloane_, Jan 19 2012
%E A204844 More terms from _Felix Fröhlich_, Aug 05 2018