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.

A327822 Numbers k such that when cyclically permuting the digits of k any number of times, any prime obtained is followed by a composite number and vice-versa.

This page as a plain text file.
%I A327822 #16 Sep 28 2019 22:33:13
%S A327822 14,16,19,20,23,29,30,32,34,35,38,41,43,47,50,53,59,61,67,70,74,76,83,
%T A327822 89,91,92,95,98,1015,1018,1070,1075,1099,1132,1136,1163,1216,1238,
%U A327822 1274,1303,1321,1339,1361,1475,1510,1517,1535,1570,1574,1612,1630,1631,1636
%N A327822 Numbers k such that when cyclically permuting the digits of k any number of times, any prime obtained is followed by a composite number and vice-versa.
%e A327822 When cyclically permuting the digits of 961990 one gets the numbers 961990, 619909, 199096, 990961, 909619, 96199 and these numbers are composite, prime, composite, prime, composite, prime, respectively, so 961990 (and each of these cyclic permutations except 96199) is a term of the sequence.
%e A327822 A more graphical representation:
%e A327822        961990              C
%e A327822       /      \           /   \
%e A327822   096199   619909       P     P
%e A327822      |        |         |     |
%e A327822   909619   199096       C     C
%e A327822       \      /           \   /
%e A327822        990961              P
%o A327822 (PARI) eva(n) = subst(Pol(n), x, 10)
%o A327822 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 A327822 is(n) = my(nn=#Str(n), u=[], v=vector(nn, x, x%2==0), w=vector(nn, x, x%2==1), d=digits(n), r=rot(d)); if(nn%2==1, return(0)); u=concat(u, [ispseudoprime(eva(d))]); u=concat(u, ispseudoprime(eva(r))); while(1, r=rot(r); if(r==d, if(u==v || u==w, return(1)); return(0)); u=concat(u, ispseudoprime(eva(r))))
%Y A327822 Cf. A068652, A068654, A270083.
%K A327822 nonn,base
%O A327822 1,1
%A A327822 _Felix Fröhlich_, Sep 26 2019