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

A105992 Near-repunit primes.

Original entry on oeis.org

101, 113, 131, 151, 181, 191, 211, 311, 811, 911, 1117, 1151, 1171, 1181, 1511, 1811, 2111, 4111, 8111, 10111, 11113, 11117, 11119, 11131, 11161, 11171, 11311, 11411, 16111, 101111, 111119, 111121, 111191, 111211, 111611, 112111, 113111, 131111, 311111, 511111
Offset: 1

Views

Author

Shyam Sunder Gupta, Apr 29 2005

Keywords

Comments

According to the prime glossary "a near-repunit prime is a prime all but one of whose digits are 1." This would also include {2, 3, 5, 7, 13, 17, 19, 31, 41, 61 and 71}, but this sequence only lists terms with more than two digits. - M. F. Hasler, Feb 10 2020

Examples

			a(2)=113 is a term because 113 is a prime and all digits are 1 except one.
		

References

  • C. Caldwell and H. Dubner, "The near repunit primes 1(n-k-1)01(1k)," J. Recreational Math., 27 (1995) 35-41.
  • Heleen, J. P., "More near-repunit primes 1(n-k-1)D(1)1(k), D=2,3, ..., 9," J. Recreational Math., 29:3 (1998) 190-195.

Crossrefs

Programs

  • Mathematica
    lst = {}; Do[r = (10^n - 1)/9; Do[AppendTo[lst, DeleteCases[Select[FromDigits[Permutations[Append[IntegerDigits[r], d]]], PrimeQ], r]], {d, 0, 9}], {n, 2, 14}]; Sort[Flatten[lst]] (* Arkadiusz Wesolowski, Sep 20 2011 *)

A088281 a(1) = 11; for n > 1, palindromic primes in which a single digit is sandwiched between strings of '1's.

Original entry on oeis.org

11, 101, 131, 151, 181, 191, 11311, 11411, 1114111, 1117111, 111181111, 111191111, 1111118111111, 111111151111111, 111111181111111, 111111111161111111111, 11111111111111611111111111111, 111111111111111111131111111111111111111, 11111111111111111111111111911111111111111111111111111
Offset: 0

Views

Author

Amarnath Murthy, Sep 29 2003

Keywords

Comments

For n > 1, near-repunit palindromic primes (or, palindromic terms of A105992). - Lekraj Beedassy, Jun 05 2009

Crossrefs

Cf. A088282, A088283, A088284 (analog with string of '3's, '7's resp. '9's).
Cf. A105992 (near-repunit primes), A065074 (which contain the digit 0), A034093 (number of primes by changing one 1 to 0), A065083 (least k for which that = n).
Cf. A164937 (near-repdigit primes); with 2, ..., 9 as repeated digit: A105982, A105981, A105980, A105979, A105978, A105977, A105976, A105975.

Programs

  • Mathematica
    Join[{11},Select[Flatten[Table[FromDigits[Join[PadRight[{},n,1],{d},PadRight[{},n,1]]],{n,26},{d,Cases[Range[0,9],Except[1]]}]],PrimeQ]] (* Harvey P. Dale, Nov 04 2024 *)
  • PARI
    print1(11); for(L=1,19,for(d=0,9,d!=1 && ispseudoprime(p=10^(2*L+1)\9+(d-1)*10^L) && print1(","p))) \\ M. F. Hasler, Feb 07 2020

Extensions

More terms from David Wasserman, Aug 03 2005
Offset changed from 0 to 1 by Lekraj Beedassy, Jun 05 2009
Edited by M. F. Hasler, Feb 07 2020

A164937 Near-repdigit primes.

Original entry on oeis.org

101, 113, 131, 151, 181, 191, 199, 211, 223, 227, 229, 233, 277, 311, 313, 331, 337, 353, 373, 383, 433, 443, 449, 499, 557, 577, 599, 661, 677, 727, 733, 757, 773, 787, 797, 811, 877, 881, 883, 887, 911, 919, 929, 977, 991, 997, 1117, 1151, 1171, 1181, 1511
Offset: 1

Views

Author

G. L. Honaker, Jr., Aug 31 2009

Keywords

Crossrefs

Programs

  • Mathematica
    lst = {}; Do[If[PrimeQ[n] && SortBy[Tally[IntegerDigits[n]], Last][[-1, -1]] == IntegerLength[n] - 1, AppendTo[lst, n]], {n, 101, 10^3}]; lst (* Arkadiusz Wesolowski, Sep 18 2011 *)
    lst = {}; Do[r = (10^n - 1)/9; Do[AppendTo[lst, DeleteCases[Select[FromDigits[Permutations[Append[IntegerDigits[a*r], d]]], PrimeQ], r | 2 | 3 | 5 | 7]], {a, 9}, {d, 0, 9}], {n, 2, 6}]; Sort[Flatten[lst]] (* Arkadiusz Wesolowski, Sep 22 2011 *)
  • Python
    from sympy import isprime
    from itertools import count, islice
    def agen(): # generator of terms
        for d in count(3):
            ds = set()
            for end in "1379":
                ds.update(int(c*(d-1) + end) for c in "123456789" if c != end)
                for diff in "0123456789":
                    if end == diff: continue
                    cands = (end*i + diff + end*(d-1-i) for i in range(d-1))
                    ds.update(int(t) for t in cands if t[0] != "0")
            yield from sorted(t for t in ds if isprime(t))
    print(list(islice(agen(), 52))) # Michael S. Branicky, May 17 2022

Extensions

Three more terms from Lekraj Beedassy, Dec 06 2009

A034093 Number of near-repunit primes that can be formed from (10^k - 1)/9 by changing just one digit from 1 to 0.

Original entry on oeis.org

0, 0, 1, 0, 1, 1, 0, 2, 1, 0, 0, 5, 0, 0, 0, 0, 2, 5, 0, 4, 0, 0, 0, 3, 0, 1, 0, 0, 1, 2, 0, 4, 1, 0, 1, 2, 0, 2, 1, 0, 0, 7, 0, 4, 0, 0, 0, 2, 0, 2, 1, 0, 1, 3, 0, 1, 0, 0, 0, 0, 0, 3, 0, 0, 0, 4, 0, 2, 0, 0, 0, 3, 0, 1, 0, 0, 1, 3, 0, 1, 0, 0, 1, 3, 0, 3, 0, 0, 1, 1, 0, 1, 0, 0, 0, 2, 0, 3, 0, 0
Offset: 1

Views

Author

Keywords

Examples

			a(12) = 5 because from (10^12 - 1)/9 = 111111111111, by changing just one digit from 1 to 0, out of the eleven candidates, 111111111101, 111111110111, 111111011111, 111011111111 and 101111111111 are primes.
		

References

  • C. K. Caldwell and H. Dubner, The near repunits primes, J. Rec. Math., Vol. 27(1), 1995, pp. 35-41.

Crossrefs

Programs

  • Mathematica
    a = {}; Do[ p = IntegerDigits[ (10^n - 1)/9 ]; c = 0; Do[ If[ q = FromDigits[ ReplacePart[p, 0, i]]; PrimeQ[q], c++ ], {i, 2, n} ]; a = Append[a, c], {n, 1, 100} ]; a (* Robert G. Wilson v, Nov 19 2001 *)
  • PARI
    a(n)=sum(i=1,n-2,ispseudoprime(10^n\9-10^i)) \\ Charles R Greathouse IV, May 01 2012
    
  • Python
    from sympy import isprime
    def a(n):
        Rn = (10**n-1)//9
        return sum(1 for i in range(n-1) if isprime(Rn-10**i))
    print([a(n) for n in range(1, 101)]) # Michael S. Branicky, Nov 04 2023

Extensions

More terms from Robert G. Wilson v, Nov 19 2001
Edited by N. J. A. Sloane, Oct 02 2008 at the suggestion of R. J. Mathar

A331863 Numbers k such that R(k) - 10^floor(k/2-1) is prime, where R(k) = (10^k-1)/9 (repunit: A002275).

Original entry on oeis.org

8, 12, 17, 20, 24, 42, 1124, 1169, 1538, 7902, 27617, 29684
Offset: 1

Views

Author

M. F. Hasler, Jan 30 2020

Keywords

Comments

The corresponding primes are a subsequence of A065074: near-repunit primes that contain the digit 0.
In base 10, R(k) - 10^floor(k/2-1) has ceiling(k/2) digits 1, one digit 0 and again floor(k/2-1) digits 1: for even as well as odd k, there is a digit 0 just right of the middle of the repunit of length k.
No term can be congruent to 1 (mod 3). - Chai Wah Wu, Feb 07 2020
a(13) > 50000. - Michael S. Branicky, Jul 23 2024

Examples

			For k = 8,  R(8)  - 10^(4-1) = 11110111 is prime.
For k = 12, R(12) - 10^(6-1) = 111111011111 is prime.
For k = 17, R(12) - 10^(8-1) = 11111111101111111 is prime.
		

Crossrefs

Cf. A002275 (repunits), A011557 (powers of 10), A065074 (near-repunit primes that contain the digit 0), A138148 (Cyclop numbers with digits 0 & 1).
Cf. A331862 (variant with floor(n/2) instead of floor(n/2-1)), A331860 (variant with + (digit 2) instead of - (digit 0)).

Programs

  • PARI
    for(n=2,9999,isprime(p=10^n\9-10^(n\2-1))&&print1(n","))

Extensions

a(7)-a(10) from Giovanni Resta, Jan 31 2020
a(11)-a(12) from Michael S. Branicky, Jul 22 2024

A065083 The least k such that precisely n near-repunit primes can be formed from (10^k-1)/9 by changing one digit from 1 to 0.

Original entry on oeis.org

1, 3, 8, 24, 20, 12, 488, 42, 162, 4848, 642, 1682
Offset: 0

Views

Author

Robert G. Wilson v, Nov 19 2001

Keywords

Comments

Least inverse of A034093. - Charles R Greathouse IV, May 01 2012
a(10) = 642 and a(11) = 1682. - Charles R Greathouse IV, May 03 2012
a(>11) > 5000. - Robert Price, Nov 06 2023

Examples

			a(5) = 12 because R_12 = (10^12 -1)/9 = 111111111111 and from this number, by changing just one digit from 1 to 0, out of the eleven candidates, 111111111101, 111111110111, 111111011111, 111011111111 and 101111111111 are primes.
		

Crossrefs

Programs

  • Mathematica
    a = Table[0, {10} ]; Do[p = IntegerDigits[ (10^n - 1)/9]; c = 0; Do[ If[ q = FromDigits[ ReplacePart[p, 0, i]]; PrimeQ[q], c++ ], {i, 2, n} ]; If[ a[[c + 1]] == 0, a[[c + 1]] = n], {n, 1, 400} ]; a
  • PARI
    a(n)=my(k=1);while(sum(i=1,k-2,ispseudoprime(10^k\9-10^i)) != n, k++); k \\ Charles R Greathouse IV, May 01 2012

Extensions

a(6) from Charles R Greathouse IV, May 01 2012
a(9) from Robert Price, Nov 04 2023
a(10)-a(11) from comments and verified by Robert Price, Nov 04 2023

A331862 Numbers n for which R(n) - 10^floor(n/2) is prime, where R(n) = (10^n-1)/9.

Original entry on oeis.org

3, 26, 186, 206, 258, 3486, 12602
Offset: 1

Views

Author

M. F. Hasler, Jan 30 2020

Keywords

Comments

The corresponding primes are a subsequence of A065074: near-repunit primes that contain the digit 0.
In base 10, R(n) - 10^floor(n/2) has ceiling(n/2)-1 digits 1, one digit 0, and again floor(n/2) digits 1. For odd n, this is a palindrome, for even n the digit 0 is just left to the middle of the number.
There can't be an odd term > 3 because the corresponding palindrome factors as R((n-1)/2)*(10^((n+1)/2) + 1).
No term can be congruent to 1 mod 3. - Chai Wah Wu, Feb 07 2020

Examples

			For n = 3, R(n) - 10^floor(n/2) = 101 is prime.
For n = 26, R(n) - 10^floor(n/2) = 11111111111101111111111111 is prime.
		

Crossrefs

Cf. A002275 (repunits), A004023 (indices of prime repunits), A011557 (powers of 10), A065074 (near-repunit primes that contain the digit 0), A105992 (near-repunit primes), A138148 (Cyclops numbers with digits 0 & 1).
Cf. A331860 (variant with digit 2 instead of digit 0), A331863 (variant with floor(n/2-1) instead of floor(n/2)).

Programs

  • PARI
    for(n=0,9999,isprime(p=10^n\9-10^(n\2))&&print1(n","))

Extensions

a(6)-a(7) from Giovanni Resta, Jan 31 2020

A263431 Near-repdigit primes with only digits 9 and a single 8 in decimal expansion.

Original entry on oeis.org

89, 8999, 98999, 99989, 989999, 9899999, 89999999, 99899999, 99998999, 99999989, 998999999, 98999999999, 99989999999, 999998999999, 999999999899, 999999999989, 99899999999999, 99999899999999, 99999999899999, 999999899999999, 999999999989999, 999999999999989
Offset: 1

Views

Author

Felix Fröhlich, Oct 18 2015

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Flatten[Table[FromDigits/@Permutations[PadRight[{8},n,9]],{n,15}]],PrimeQ] (* Harvey P. Dale, Mar 29 2020 *)
  • PARI
    a002283(n) = 10^n-1
    a011557(n) = 10^n
    num(n, k) = a002283(n)-a011557(k)
    terms(n) = i=0; x=1; while(x > 0, y=x-1; while(y >= 0, if(ispseudoprime(num(x, y)), print1(num(x, y), ", "); i++); if(i==n, break({2})); y--); x++)
    terms(30) \\ print initial thirty terms

A367081 The least k such that exactly n binary near-repunit primes can be formed from 2^k-1 by changing one digit from 1 to 0.

Original entry on oeis.org

1, 3, 4, 6, 8, 12, 38, 24, 18, 36, 48, 20, 248, 588, 144, 252, 5520, 168, 7200, 2400, 2850
Offset: 0

Views

Author

Robert Price, Nov 06 2023

Keywords

Comments

Similar to A065083 but using binary repdigits instead of base 10.
Note that as in A065083, the most significant digit/bit is not replaced with a zero in determining a prime.
a(21) > 7800.
a(25) = 11520 and a(n) > 12000 for n in 21..24 and n > 25 using A272143. - Michael S. Branicky, Nov 09 2023

Examples

			a(3)=6 because 2^6 - 1 = 111111_2 and
                      1) 111101_2 = 61,
                      2) 111011_2 = 59,
                      3) 101111_2 = 47,
and no other k < 6 yields exactly three primes.
		

Crossrefs

Programs

  • PARI
    a(n) = my(k=1); while(sum(i=1, k-2, ispseudoprime(2^k-1-2^i)) != n, k++); k \\ Thomas Scheuerle, Nov 07 2023
    
  • Python
    from itertools import count
    from sympy import isprime
    def A367081(n):
        for k in count(1):
            a, c = (1<= n+1:
                    break
            if c == n:
                return k # Chai Wah Wu, Nov 11 2023

A168340 Near-repunit emirps with a single 0 in their decimal expansion.

Original entry on oeis.org

101111111111, 111011111111, 111111110111, 111111111101, 111110111111111111, 111111111111011111, 11011111111111111111, 11111111111111111011, 111111111111111111111101111111111111111111111111111111, 111111111111111111111111111111101111111111111111111111
Offset: 1

Views

Author

Lekraj Beedassy, Nov 23 2009

Keywords

Comments

Emirps A006567 which are also "near" repunits (near indicating that one non-leading 1-digit is replaced by a 0).

Crossrefs

Cf. A065074.

Formula

A065074 INTERSECT A006567. [R. J. Mathar, Nov 26 2009]

Extensions

6 more terms from R. J. Mathar, Nov 26 2009
Name changed by Arkadiusz Wesolowski, Sep 23 2011
Showing 1-10 of 10 results.