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 11 results. Next

A051003 Beastly (or hateful) numbers: numbers containing the string 666 in their decimal expansion.

Original entry on oeis.org

666, 1666, 2666, 3666, 4666, 5666, 6660, 6661, 6662, 6663, 6664, 6665, 6666, 6667, 6668, 6669, 7666, 8666, 9666, 10666, 11666, 12666, 13666, 14666, 15666, 16660, 16661, 16662, 16663, 16664, 16665, 16666, 16667, 16668, 16669, 17666, 18666
Offset: 1

Views

Author

Keywords

Crossrefs

Programs

  • Mathematica
    Select[Range[18666], ! StringFreeQ[ToString[#], "666"] &] (* Arkadiusz Wesolowski, Sep 08 2011 *)

A166580 Prime numbers containing the string 222.

Original entry on oeis.org

2221, 12227, 22229, 22247, 22259, 22271, 22273, 22277, 22279, 22283, 22291, 42221, 42223, 42227, 52223, 72221, 72223, 72227, 72229, 82223, 92221, 92227, 102229, 112223, 122201, 122203, 122207, 122209, 122219, 122231, 122251, 122263, 122267, 122273, 122279, 122299, 132229, 142223
Offset: 1

Views

Author

Vincenzo Librandi, Nov 01 2009

Keywords

Crossrefs

Programs

  • Magma
    res := []; for n in [1..15000] do p := NthPrime(n); digits := IntegerToSequence(p); for i in [1..#digits - 2] do if digits[i..i+2] eq [2,2,2] then Append(~res, p); break; end if; end for; end for; res; // Vincenzo Librandi, Jul 16 2025
  • Mathematica
    p222Q[n_] := Module[{idn = IntegerDigits[n]}, MemberQ[Partition[idn, 3, 1], {2, 2, 2}]]; Select[Prime[Range[15000]], p222Q] (* Vincenzo Librandi Sep 14 2012 *)
    Select[Prime[Range[12000]],SequenceCount[IntegerDigits[#],{2,2,2}]>0&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 08 2017 *)
  • PARI
    contains(n,k)=my(N=digits(n),K=digits(k)); for(i=0,#N-#K, for(j=1,#K,if(N[i+j]!=K[j],next(2))); return(1)); 0
    is(n)=isprime(n) && contains(n,222) \\ Charles R Greathouse IV, Jun 20 2014
    

Formula

a(n) ~ n log n. - Charles R Greathouse IV, Jun 20 2014

A186086 Beastly primes (version 1): either 666 followed by 0's and a 1 or 7 at the right end or a palindrome with 666 in the center, 0's surrounding these digits, and 1 or 7 at both ends.

Original entry on oeis.org

6661, 16661, 66601, 76667, 700666007, 6660000000001, 666000000000001, 700000666000007, 70000006660000007, 6660000000000000000000000007, 66600000000000000000000000007, 1000000000000066600000000000001
Offset: 1

Views

Author

Arkadiusz Wesolowski, Feb 12 2011

Keywords

Comments

Differs from A131645 in that 26669, 46663, 56663, 66617, 66629, 66643, 66653, 66683, 66697, 96661, 96667, 106661, 106663, 106669, 116663, 146669, 166601, 166603, 166609, 166613, 166619, 166627, 166631, 166643, 166657, 166667, 166669, 166679, are not included here.
76667 is the largest beastly prime that does not contain the digit "0".

Crossrefs

Programs

  • Mathematica
    e = 14; p = 666*10^n + 1; q = (10^(n + 2) + 666)*10^n + 1; Select[Union[Table[p, {n, 2*e}], Table[p + 6, {n, 2*e}], Table[q, {n, e}], Table[q + 6*10^(2*n + 2) + 6, {n, e}]], PrimeQ] (* Arkadiusz Wesolowski, Sep 21 2011 *)
    Module[{nn=35,bp1,bp2,bp3,bp4}, bp1=FromDigits/@ Table[Join[PadRight[ {6,6,6},n1,0],{1}],{n1,3,nn}]; bp2=FromDigits/@ Table[Join[ PadRight[ {6,6,6},n2,0],{7}], {n2,3,nn}]; bp3=FromDigits/@ Table[Join[PadRight[ {1},n3,0], {6,6,6},PadLeft[ {1},n3,0]],{n3,1,nn/2}];bp4=FromDigits/@ Table[Join[PadRight[{7},n3,0],{6,6,6}, PadLeft[ {7},n3,0]],{n3,1,nn/2}]; Select[Sort[Join[bp1,bp2,bp3,bp4]],PrimeQ]] (* Harvey P. Dale, Jan 18 2017 *)

Extensions

Edited by N. J. A. Sloane, Feb 12 2011
a(10)-a(12) from Charles R Greathouse IV, Feb 12 2011

A046720 Subsequence of beastly primes (A186086) that are palindromes that begin and end with 7.

Original entry on oeis.org

76667, 700666007, 700000666000007, 70000006660000007
Offset: 1

Views

Author

Keywords

Comments

Next term is 7_{0}^48_666_{0}^48_7, containing 101 digits, and is too large to include here.
The number of digits in the terms is 2*A186521(n)+3: 5, 9, 15, 17, 101, 1159, 1589, 2647, 2787, 4787, 6135, 26961 (some correspond to probable primes). - Jens Kruse Andersen, Jul 13 2014

Crossrefs

Programs

  • Mathematica
    Select[Table[(7*10^(n + 2) + 666)*10^n + 7, {n, 7}], PrimeQ] (* Arkadiusz Wesolowski, Sep 08 2011 *)
    Select[Table[With[{s=PadRight[{7},n,0]},FromDigits[Join[s,{6,6,6},Reverse[s]]]],{n,8}],PrimeQ] (* Harvey P. Dale, Aug 05 2024 *)

Formula

a(n) = (7*10^(k+2)+666)*10^k+7, where k = A186521(n). - Jens Kruse Andersen, Jul 13 2014

Extensions

Definition revised by N. J. A. Sloane, Feb 14 2011

A243527 Prime numbers containing the string 111.

Original entry on oeis.org

1117, 2111, 4111, 8111, 10111, 11113, 11117, 11119, 11131, 11149, 11159, 11161, 11171, 11173, 11177, 11197, 16111, 22111, 25111, 26111, 28111, 35111, 40111, 41113, 41117, 44111, 47111, 50111, 58111, 65111, 68111, 70111, 71119, 79111, 80111
Offset: 1

Views

Author

Vincenzo Librandi, Jun 06 2014

Keywords

Crossrefs

Cf. prime numbers containing the string kkk: this sequence (k=1), A166580 (k=2), A166581 (k=3), A166582 (k=4), A167281 (k=5), A131645 (k=6), A167282 (k=7), A167290 (k=8), A167292 (k=9).

Programs

  • Mathematica
    Select[Prime[Range[90000]], !StringFreeQ[ToString[#], "111"]&]
  • PARI
    contains(n,k)=my(N=digits(n),K=digits(k)); for(i=0,#N-#K, for(j=1,#K,if(N[i+j]!=K[j],next(2))); return(1)); 0
    is(n)=isprime(n) && contains(n,111) \\ Charles R Greathouse IV, Jun 20 2014

Formula

a(n) ~ n log n. - Charles R Greathouse IV, Jun 20 2014

A196023 Primes that are palindromes and have 666 in the middle.

Original entry on oeis.org

16661, 76667, 3166613, 3466643, 7466647, 7666667, 145666541, 148666841, 152666251, 155666551, 169666961, 176666671, 181666181, 304666403, 305666503, 307666703, 308666803, 329666923, 347666743, 349666943, 373666373, 374666473, 383666383, 391666193, 397666793
Offset: 1

Views

Author

Arkadiusz Wesolowski, Sep 26 2011

Keywords

References

Crossrefs

Subsequence of A131645.

Programs

  • Mathematica
    Select[Table[FromDigits@Join[Flatten@IntegerDigits@PadLeft[{666}, 2, n], Reverse@IntegerDigits[n]], {n, 397}], PrimeQ] (* Arkadiusz Wesolowski, Dec 03 2011 *)

A386247 Primes containing 000 as a substring.

Original entry on oeis.org

10007, 10009, 40009, 70001, 70003, 70009, 90001, 90007, 100003, 100019, 100043, 100049, 100057, 100069, 130003, 140009, 150001, 160001, 160009, 170003, 180001, 180007, 200003, 200009, 200017, 200023, 200029, 200033, 200041, 200063, 200087, 220009, 230003, 240007
Offset: 1

Views

Author

Alois P. Heinz, Jul 16 2025

Keywords

Comments

Differs from A164968 first at n=10: a(10) = 100019 < 200003 = A164968(10).

Crossrefs

Programs

  • Mathematica
    Select[Prime[Range[1230, 25000]], StringContainsQ[IntegerString[#], "000"] &] (* Paolo Xausa, Jul 19 2025 *)

A260312 Palindromic beastly primes that begin and end with digit '1'.

Original entry on oeis.org

16661, 1000000000000066600000000000001, 10000000000000000000000000000000000000000006660000000000000000000000000000000000000000001
Offset: 1

Views

Author

K. D. Bajpai, Jul 22 2015

Keywords

Comments

The next term a(4) contains 1017 digits, and is too large to include in data section.

Examples

			a(1) = 16661 is a palindromic prime that contains the beastly number '666' and begins and ends with digit 1.
a(2) = 1000000000000066600000000000001 is palindromic prime that contains the beastly number '666' and begins and ends with digit 1.
		

Crossrefs

Programs

  • Magma
    [k: n in [1..1000] | IsPrime(k) where k is ((1*10^(n + 2) + 666)*10^n + 1 )];
  • Maple
    A260312:= n-> ((1*10^(n + 2) + 666)*10^n + 1 ): select(isprime, [seq((A260312 (n), n=1..100))]);
  • Mathematica
    Select[Table[(1*10^(n + 2) + 666)*10^n + 1, {n, 1000}], PrimeQ]
    Select[Table[FromDigits[Join[{1},PadRight[{},n,0],{6,6,6},PadRight[ {},n,0],{1}]],{n,0,50}],PrimeQ] (* Harvey P. Dale, Jul 09 2017 *)
  • PARI
    for(n=1, 500, k=((1*10^(n + 2) + 666)*10^n + 1 ); if(isprime(k), print1(k, ", ")));
    

A321001 Primes which contain the fax number of the beast (667).

Original entry on oeis.org

1667, 6673, 6679, 10667, 15667, 16673, 25667, 31667, 34667, 36671, 36677, 39667, 42667, 45667, 46679, 49667, 52667, 54667, 55667, 56671, 57667, 61667, 63667, 64667, 66701, 66713, 66721, 66733, 66739, 66749, 66751, 66763, 66791, 66797, 70667, 76667
Offset: 1

Views

Author

N. J. A. Sloane, Nov 01 2018

Keywords

Comments

Since the so-called beastly primes (containing the digit string 666) were mentioned recently in a Numberphile video (see link), I guess it is now OK to include these numbers (which are based on the old convention that your fax number was one more than your telephone number) in the OEIS.
Note that there is no analog of A232448, because 1 0^k 667 0^k 1 is always divisible by 3 and is never prime.

Crossrefs

Cf. beastly primes A131645, also A232448.

A286342 Smallest beastly prime in base n: smallest prime p with a base-n expansion containing the substring 666.

Original entry on oeis.org

2399, 3511, 4919, 6661, 2129, 11311, 14281, 17729, 21701, 26209, 26407, 37049, 43441, 50527, 252823, 66931, 64153, 86561, 19531, 109673, 122651, 136601, 151561, 167593, 184703, 202949, 222361, 242971, 50441, 287933, 261707, 338137, 365291, 393847, 79259
Offset: 7

Views

Author

Felix Fröhlich, May 07 2017

Keywords

Comments

No such p exists for n < 7.
Does p exist for every n > 6?
Answer: yes. For a given n, consider the sequence {k*n^4 + 6*n^3 + 6*n^2 + 6*n + 1}. By Dirichlet's theorem on arithmetic progressions, there exist infinitely many primes of this form, and they all end in 6661 in base n. - Jianing Song, Feb 03 2019

Examples

			For n = 7: 2399 written in base 7 is 6665. Since 2399 is the smallest prime that contains the substring 666 in its base-7 expansion, a(7) = 2399.
		

Crossrefs

Cf. A131645.

Programs

  • Mathematica
    Table[k = FromDigits[#, b]; While[Nand[PrimeQ@ k, Length@ SequencePosition[IntegerDigits[k, b], #] > 0], k++]; k, {b, 7, 41}] &@ ConstantArray[6, 3] (* Michael De Vlieger, May 08 2017 *)
  • PARI
    a(n) = forprime(p=1, , my(subs=[6, 6, 6], dbn=digits(p, n)); for(k=1, #dbn-2, my(v=[dbn[k], dbn[k+1], dbn[k+2]]); if(v==subs, return(p))))

Formula

n^3 < a(n) << n^20. - Charles R Greathouse IV, May 13 2017
Probably n^3 < a(n) < n^4 for all but finitely many n. It appears the only exceptions are 21 and 52. If there are any others they are larger than 10^7; the expected number of larger exceptions is about 10^-89814. - Charles R Greathouse IV, May 13 2017
Showing 1-10 of 11 results. Next