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

A270083 Near-miss circular primes: Primes p where all but one of the numbers obtained by cyclically permuting the digits of p are prime.

Original entry on oeis.org

19, 23, 29, 41, 43, 47, 53, 59, 61, 67, 83, 89, 101, 103, 107, 127, 149, 157, 163, 173, 181, 191, 271, 277, 307, 313, 317, 331, 359, 367, 379, 397, 419, 479, 491, 571, 577, 593, 617, 631, 673, 701, 709, 727, 739, 757, 761, 787, 797, 811, 839, 877, 907, 911
Offset: 1

Views

Author

Felix Fröhlich, Mar 10 2016

Keywords

Comments

Prime p is a term of the sequence iff A262988(p) = A055642(p) - 1.
If a(512) exists, it is larger than 10^16. - Giovanni Resta, Apr 27 2017
If one of the digits is even or 5, the miss occurs when that digit is permuted to the ones place. Avoiding that simple obstruction, this sequence intersected with A091633 is 19, 173, 191, 313, 317, 331, 379, 397, 739, 797, 911, 937, 977, 1319, 1777, 1913, 1979, 1993, 3191, 3373, 3719, 3733, 3793, ... . Is this an infinite subsequence? - Danny Rorabaugh, May 15 2017

Crossrefs

Programs

A293663 Circular primes that are not repunits.

Original entry on oeis.org

2, 3, 5, 7, 13, 17, 31, 37, 71, 73, 79, 97, 113, 131, 197, 199, 311, 337, 373, 719, 733, 919, 971, 991, 1193, 1931, 3119, 3779, 7793, 7937, 9311, 9377, 11939, 19391, 19937, 37199, 39119, 71993, 91193, 93719, 93911, 99371, 193939, 199933, 319993, 331999, 391939
Offset: 1

Views

Author

Felix Fröhlich, Dec 30 2017

Keywords

Comments

Relative complement of A004022 in A068652.
Conjecture: The sequence is finite.
From Michael De Vlieger, Dec 30 2017: (Start)
Primes > 5 in this sequence must only have digits that are in the reduced residue system modulo 10, i.e., {1, 3, 7, 9}.
There are 54 terms that have 6 or fewer decimal digits, the largest of which is 999331.
a(55) must be larger than 10^11. (End) [Corrected by Felix Fröhlich, Mar 15 + 24 2019]
From Felix Fröhlich, Mar 16 2019: (Start)
a(55) > 10^23 if it exists (cf. De Geest link).
Numbers k such that A262988(k) = A055642(k). (End)

Examples

			The numbers resulting from cyclic permutations of the digits of 1193 are 1931, 9311 and 3119, respectively and all those numbers are prime, so 1193, 1931, 3119 and 9311 are terms of the sequence.
		

Crossrefs

Cf. base-b nonrepunit circular primes: A293657 (b=4), A293658 (b=5), A293659 (b=6), A293660 (b=7), A293661 (b=8), A293662 (b=9).

Programs

  • Mathematica
    Select[Prime@ Range[10^5], Function[w, And[AllTrue[Array[FromDigits@ RotateRight[w, #] &, Length@ w - 1], PrimeQ], Union@ w != {1} ]]@ IntegerDigits@ # &] (* or *)
    Select[Flatten@ Array[FromDigits /@ Most@ Rest@ Tuples[{1, 3, 7, 9}, #] &, 9, 2], Function[w, And[AllTrue[Array[FromDigits@ RotateRight[w, #] &, Length@ w], PrimeQ], Union@ w != {1} ]]@ IntegerDigits@ # &] (* Michael De Vlieger, Dec 30 2017 *)
  • 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_circularprime(p) = my(d=digits(p), 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))))
    forprime(p=1, , if(vecmax(digits(p)) > 1, if(is_circularprime(p), print1(p, ", "))))
    
  • PARI
    /* The following is a much faster program that only tests numbers whose decimal expansion consists of digits from the set {1, 3, 7, 9}. */
    eva(n) = subst(Pol(n), x, 10)
    next_v(vec) = my(k=#vec); if(vecmin(vec)==9, vec=concat(vector(#vec, t, 1), [3]); return(vec)); while(k > 0, if(vec[k]==9, vec[k]=1, if(vec[k]==3, vec[k]=7; return(vec), vec[k]=vec[k]+2, return(vec))); k--)
    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
    search(n) = my(d=digits(n), e=[], ed=0); while(1, e=rot(d); while(1, if(!ispseudoprime(eva(e)), break, e=rot(e); if(e==d && ispseudoprime(eva(e)), print1(eva(d), ", "); break))); d=next_v(d))
    searchfrom(n) = if(n < 12, forprime(p=n, 10, print1(p, ", ")); search(13), my(d=digits(n)); for(k=1, #d, if(d[k]%2==0, d[k]++, if(d[k]==5, d[k]=7))); search(eva(d)))
    /* Start a search from 1 upwards as follows: */
    searchfrom(1) \\ Felix Fröhlich, Mar 23 2019

A317716 Square array A(n, k), read by antidiagonals downwards: k-th prime p such that cyclic digit shifts produce exactly n different primes.

Original entry on oeis.org

2, 3, 13, 5, 17, 113, 7, 31, 131, 1193, 11, 37, 197, 1931, 11939, 19, 71, 199, 3119, 19391, 193939, 23, 73, 311, 3779, 19937, 199933, 17773937, 29, 79, 337, 7793, 37199, 319993, 39371777, 119139133, 41, 97, 373, 7937, 39119, 331999, 71777393, 133119139
Offset: 1

Views

Author

Felix Fröhlich, Aug 05 2018

Keywords

Comments

k-th prime p such that A262988(p) = n.
Are all rows of the array infinite?
A term q of A270083 occurs in row A055642(q) - 1 in this array.
A term r of A293663 occurs in row A055642(r) in this array.
Row 1 is a supersequence of A004022.
Column 1 is A247153.

Examples

			Array starts
          2,         3,         5,         7,        11,        19,        23, ...
         13,        17,        31,        37,        71,        73,        79, ...
        113,       131,       197,       199,       311,       337,       373, ...
       1193,      1931,      3119,      3779,      7793,      7937,      9311, ...
      11939,     19391,     19937,     37199,     39119,     71993,     91193, ...
     193939,    199933,    319993,    331999,    391939,    393919,    919393, ...
   17773937,  39371777,  71777393,  73937177,  77393717,  77739371,  93717773, ...
  119139133, 133119139, 139133119, 191391331, 311913913, 331191391, 913311913, ...
...
		

Crossrefs

Programs

  • 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
    count_primes(n) = my(d=digits(n), i=0); while(1, if(ispseudoprime(eva(d)), i++); d=rot(d); if(d==digits(n), return(i)))
    row(n, terms) = my(i=0); forprime(p=1, , if(count_primes(p)==n, print1(p, ", "); i++); if(i==terms, print(""); break))
    array(rows, cols) = for(x=1, rows, row(x, cols))
    array(7, 7) \\ print initial 7 rows and 7 columns of array

A247153 a(n) = smallest prime p for which cyclic digit shifts produce exactly n different primes, or 0 if no such p exists for n.

Original entry on oeis.org

2, 13, 113, 1193, 11939, 193939, 17773937, 119139133, 111133719913, 111119917373, 111393733793, 1117739771979737
Offset: 1

Views

Author

Felix Fröhlich, Nov 21 2014

Keywords

Comments

a(n) is equal to the smallest n-digit non-repunit prime in A016114, unless no n-digit non-repunit prime exists in A016114. In that case, the number of digits of a(n), if it exists, must be > n.
From David A. Corneth, Aug 06 2018: (Start)
Do we have leading digit of a(n) <= any digit from a(n)?
For n > 1, can a(n) contain a digit d with gcd(10, d) > 1? (End)
Smallest prime p such that A262988(p) = n. - Felix Fröhlich, Aug 06 2018

Crossrefs

Cf. A016114, A262988. This is column 1 of A317716.

Extensions

a(7)-a(8) from P. De Geest's website added by Felix Fröhlich, Nov 26 2014
a(9)-a(12) from Robert G. Wilson v, Aug 06 2018

A317756 Number of distinct primes obtained by cyclically shifting the decimal digits of the n-th prime.

Original entry on oeis.org

1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 1, 1, 2, 2, 2, 2, 1, 3, 2, 3, 1, 1, 2, 1, 2, 2, 1, 2, 1, 2, 2, 1, 3, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 1, 1, 1, 2, 3, 2, 2, 2, 3, 1, 1, 1, 2, 2, 3, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2
Offset: 1

Views

Author

Keywords

Comments

First occurrence of k, k=1,2,3,...: 2, 13, 113, 1193, 11939, 193939, 17773937, 119139133, ..., . A247153.
a(n) is equal to the row index of prime(n) in A317716.
Every positive integer occurs in this sequence if and only if A247153(i) != 0 for every i >= 1.

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]] (* after Michael De Vlieger in A262988 *); Array[Length@f@Prime@# &, 105] (* Robert G. Wilson v, Aug 06 2018 *)
    Table[Count[Union[FromDigits/@Table[RotateRight[IntegerDigits[p],n],{n,IntegerLength[p]}]],?PrimeQ],{p,Prime[Range[120]]}] (* _Harvey P. Dale, Jan 18 2025 *)
  • 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
    count_primes(n) = my(d=digits(n), i=0); while(1, if(ispseudoprime(eva(d)), i++); d=rot(d); if(d==digits(n), return(i)))
    a(n) = my(p=prime(n)); count_primes(p) \\ Felix Fröhlich, Aug 06 2018

Formula

a(n) = A262988(A000040(n)).
Showing 1-5 of 5 results.