%I #15 Oct 08 2019 22:21:10
%S 0,0,1,3,4,7,9,7,11,12,15,14,18,23,20,28,18,24,30,31,35,34,32,29,48,
%T 41,40,45,35,54,58,50,56,54,47,43,78,47,74,70,50,69,63,93,82,78,78,
%U 103,69,62,82,79,82,87,68,92,100,80,120,89,117,91,112,132,97,93
%N a(n) is the number of integers b with 1 < b < p such that p = prime(n) is a base-b nonrepunit circular prime with at least two base-b digits.
%C Conjecture: a(n) > 0 for n > 2.
%e For n = 4: 7 is the 4th prime and in base 3, 7 is 21, with 12 equal to 5 in decimal, which is prime, in base 4, 7 is 13, with 31 equal to 13 in decimal, which is prime and in base 5, 7 is 12, with 21 equal to 11 in decimal, which is prime. Altogether, there are 3 such bases, so a(4) = 3.
%o (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
%o decimal(v, base) = my(w=[]); for(k=0, #v-1, w=concat(w, v[#v-k]*base^k)); sum(i=1, #w, w[i])
%o is_circularprime(p, base) = my(db=digits(p, base), r=rot(db), i=0); if(vecmin(db)==0, return(0), while(1, dec=decimal(r, base); if(!ispseudoprime(dec), return(0)); r=rot(r); if(r==db, return(1))))
%o count_bases(n) = my(i=0); for(b=3, n-1, if(vecmin(digits(n, b))!=vecmax(digits(n, b)), if(is_circularprime(n, b), i++))); i
%o forprime(p=1, 400, print1(count_bases(p), ", "))
%Y Cf. A293142.
%K nonn,base
%O 1,4
%A _Felix Fröhlich_, Oct 03 2019
|