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

A185682 Irregular triangle, read by rows, of primes with prefix n and digits "1" appended, otherwise 0.

Original entry on oeis.org

11, 0, 31, 311, 41, 0, 61, 71, 0, 0, 101, 0, 0, 131, 0, 151, 1511, 0, 0, 181, 1811, 191, 0, 211, 2111, 0, 0, 241, 2411, 251, 0, 271, 2711, 281, 0, 0, 311, 0, 331, 0, 0, 0, 0, 0, 0, 401, 0, 421, 4211, 431, 0, 0, 461, 0, 0, 491, 0, 0, 521, 0, 541, 0, 0, 571, 5711, 0, 0, 601, 6011, 0, 0
Offset: 1

Views

Author

Michel Lagneau, Feb 10 2011

Keywords

Comments

Row n ends when a composite number is found.
No row has more than two terms. - Robert Israel, Sep 06 2024

Examples

			For k=1..2, a(15, k) = {151, 1511} are in the sequence.
Triangle begins:
   11;
    0;
   31, 311;
   41;
    0;
   61;
   71;
    0;
    0;
  101;
  ...
		

Crossrefs

Cf. A069568 (least number of 1's to append to n to make a prime).

Programs

  • Maple
    with(numtheory): for n from 1 to 100 do:a0:=n:id:=0:c:=0:for k from 1 to 20
      while (id=0) do:a1:=a0*10+1:if type(a1,prime)=true then a0:=a1:printf(`%d, `,a0):c:=c+1:else
      id:=1:fi:od:if c=0 then printf(`%d, `,0):else fi:od:~
  • Mathematica
    Reap[Do[cnt = 0; d = IntegerDigits[n]; While[p = FromDigits[AppendTo[d, 1]]; PrimeQ[p], cnt++; Sow[p]]; If[cnt == 0, Sow[0]], {n, 61}]][[2, 1]]

A112386 Smallest prime obtained by appending one or more 1's to n, -1 if no such prime exists.

Original entry on oeis.org

11, 211, 31, 41, 511111, 61, 71, 811, 911, 101, 1111111111111111111, 121111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111, 131, 14111111111, 151, 16111, 1711111111, 181, 191, 2011, 211, 22111, 2311, 241
Offset: 1

Views

Author

Michel Dauchez (mdzdm(AT)yahoo.fr), Dec 04 2005

Keywords

Comments

a(37) = -1 since there is a covering of the set {371, 3711, 37111, ...} by the prime moduli 3, 7, 13, 37. Hence, there are infinitely many values -1 in the sequence (at 371, 3711, 37111, ...). - Emmanuel Vantieghem, Oct 27 2022
a(38) = -1 because 38 followed by m >= 1 1's is divisible by 3 or 37 or by (7*10^k-1)/3 if m = 3k. - Toshitaka Suzuki, Nov 07 2023

Examples

			a(5) = 511111 because 51, 511, 5111 and 51111 are not primes.
		

Crossrefs

Programs

  • Mathematica
    f[n_] := Block[{k = 1, e = Floor[Log[10, n] + 1]}, While[ !PrimeQ[n*10^k + (10^k - 1)/9], k++ ]; n*10^k + (10^k - 1)/9]; Array[f, 24] (* Robert G. Wilson v, Dec 05 2005 *)
    Table[SelectFirst[Table[FromDigits[PadRight[IntegerDigits[k],n,1]],{n,IntegerLength[k]+1,250}],PrimeQ],{k,25}] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 30 2017 *)

Extensions

Edited, corrected and extended by Robert G. Wilson v, Dec 05 2005
Name edited by Emmanuel Vantieghem, Oct 27 2022

A083747 Smallest number m >= 0 such that n followed by m ones yields a prime; a(p) = -1 if no such m exists.

Original entry on oeis.org

1, 0, 0, 1, 0, 1, 0, 2, 2, 1, 0, 136, 0, 9, 1, 3, 0, 1, 0, 2, 1, 3, 0, 1, 1, 3, 1, 1, 0, 2, 0, 35, 1, 6, 2, 4, 0, -1, 2, 1, 0, 1, 0, 3, 772, 1, 0, 5, 1, 2, 4, 1, 0, 1, 31, 18470, 1, 3, 0, 1, 0, 2, 1, 1, 3, 1, 0, 3, 1, 1, 0, 2, 0, 2, 1, 1, 9, 4, 0, 2, 1, 1, 0, 5, 6, 3, 149, 1, 0, 2, 1, 3, 2, 1, 2, 7, 0, 2, 1, 10, 0, 1, 0, 44, 1, 1, 0, 5, 0, 17, 16, 3, 0, 2, 1, 9, 1, 1, 5, 1
Offset: 1

Views

Author

Jason Earls, Jun 16 2003

Keywords

Comments

a(38) = -1 means no prime has yet been found; a(176) = -1 because it has been proved never to reach a prime. a(45) = 772 and a(56) = 18470 found by Richard Heylen; a(45) has been proved prime while a(56) is 3-PRP.
Number of times 1 has to be repeatedly appended to n to form a prime. - Lekraj Beedassy, Jun 01 2006
The statement "no prime has yet been found" is misleading: if a(n) was unknown, the terms listed here should stop at a(n-1). A term a(n) = -1 means it can be proven that it will never yield a prime. We can show this for n = 38, see Examples. - M. F. Hasler, Jun 05 2024

Examples

			a(8) = 2 because 8 and 81 are composite but 811 is prime.
From _M. F. Hasler_, Jun 05 2024: (Start)
For n = 38, a(38) = -1 because the number 38 with m ones appended is divisible by 3 whenever m == 1 (mod 3) and by 37 for m == 2 (mod 3), and for m = 3k, k >= 0, it equals (x^3 - 1)/9 = (x - 1)/3 * (x^2 + x + 1)/3 with x = 7*10^k.
For n = 176, a(176) = -1 because appending any number m of 1's will always yield a number divisible by 11 if m is even, by 3 if m == 1 (mod 3), by 7 if m == 5 (mod 6) or by 13 if m == 3 (mod 6). (End)
		

Crossrefs

Cf. A069568.

Programs

  • PARI
    { aop(n, stop=500) = for(c=0, stop, isprime(n) && return(c); n=n*10+1); -1 } \\ Return value -1 means that a(n) = -1 or a(n) > stop, the search limit given as 2nd optional parameter.

Extensions

Definition and PARI/GP code edited by M. F. Hasler, Jun 05 2024

A363922 a(n) = smallest number m > 0 such that n followed by m 7's yields a prime, or -1 if no such m exists.

Original entry on oeis.org

1, 2, 1, 1, 2, 1, -1, 2, 1, 1, 3, 1, 1, -1, 1, 1, 2, 2, 1, 6, -1, 1, 2, 2, 1, 2, 1, -1, 48, 1, 1, 5, 1, 1, -1, 1, 10, 2, 1, 12, 2, -1, 3, 3, 1, 1, 3, 1, -1, 2, 8, 7, 3, 1, 1, -1, 1, 1, 9, 1, 1, 2, -1, 1, 2, 5, 1, 3, 2, -1, 2, 1, 66, 2, 1, 3, -1, 1, 1, 3
Offset: 1

Views

Author

Toshitaka Suzuki, Jul 12 2023

Keywords

Comments

a(n) = -1 when n = 7*k because no matter how many 7's are appended to n, the resulting number is always divisible by 7 and therefore cannot be prime.
a(n) = -1 when n = 15873*k + 891, 1261, 2889, 3263, 3300, 7810, 8917, 9812, 12617, 13024, 14615 or 15066, because n followed by any positive number, m say, of 7's is divisible by at least one of the primes {3,11,13,37}.
Similarly,
a(n) = -1 when n = 11111111*k + 964146, 1207525, 2342974, 3567630, 7525789, 8134540, 8591231 or 9641467 by primes {11,73,101,137};
a(n) = -1 when n = 429000429*k + 23928593, 27079312, 36492115, 41207969, 52285750, 80569929, 89920882, 93857078, 133928703, 217208145, 223492302, 236849444, 239285937, 247857232, 259793116, 270793127, 323985244, 332698824, 333570182, 334985255, 346849554, 364921157, 376698868 or 412079697 by primes {3,11,13,101,9901};
a(n) = -1 when n = 1221001221*k + 14569863, 28792885, 145698637, 167698659, 225079510, 235985156, 247079532, 287928857, 331921124, 399492478, 415286113, 421492500, 437286135, 455985376, 489857474, 529929099, 551921344, 635208563, 709857694, 877208805, 896850104, 993570842, 1029793886 or 1138850346 by primes {3,11,37,101,9901};
a(n) = -1 when n = 1443001443*k + 85928655, 167698659, 176928746, 218921011, 233985154, 247079532, 310492389, 326286024, 376857361, 585793442, 655208583, 700699192, 746208674, 780080065, 791570640, 805850013, 843492922, 859286557, 882570731, 896850104, 1027793884, 1219922012, 1234986155 or 1377858362 by primes {3,13,37,101,9901}.
a(4444) > 300000 or a(4444) = -1.

Examples

			a(11)=3 because 117 and 1177 are composite but 11777 is prime.
		

Crossrefs

Programs

  • PARI
    a(n) = if ((n%7), my(m=1); while (!isprime(eval(concat(Str(n), Str(7*(10^m-1)/9)))), m++); m, -1); \\ Michel Marcus, Jul 17 2023

A372262 a(n) = smallest number m > 0 such that n followed by m 3's yields a prime, or -1 if no such m exists.

Original entry on oeis.org

1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 14, 2, -1, 1, 1, -1, 1, 3, -1, 1, 1, -1, 8, 1, -1, 1, 1, -1, 1, 4, -1, 2, 1, -1, 1, 1, -1, 483, 2, -1, 1, 1, -1, 1, 2, -1, 2, 1, -1, 1, 2, -1, 3, 1, -1, 6, 1, -1, 1, 5, -1, 1, 1, -1, 1, 1, -1, 5, 3, -1, 1, 1, -1, 3, 1, -1, 2, 4
Offset: 1

Views

Author

Toshitaka Suzuki, Apr 24 2024

Keywords

Comments

a(n) = -1 when n = 3*k because no matter how many 3's are appended to n, the resulting number is always divisible by 3 and therefore cannot be prime.
a(n) = -1 when n = 37037*k + 2808, 3666, 4070, 9287, 18799, 21574, 28083, 30558, 33300, 33740, 36663 or 36707, because n followed by any positive number, m say, of 3's is divisible by at least one of the primes {7,11,13,37}.
a(817) > 300000 or a(817) = -1.

Examples

			a(20)=3 because 203 and 2033 are composite but 20333 is prime.
		

Crossrefs

Programs

  • Mathematica
    snm[n_]:=Module[{k=1},If[Mod[n,3]==0,-1,While[CompositeQ[FromDigits[ PadRight[ IntegerDigits[ n],k+ IntegerLength[ n],3]]],k++];k]]; Array[snm,80] (* Harvey P. Dale, Aug 06 2024 *)

A373201 a(n) = smallest number m > 0 such that n followed by m 9's yields a prime, or -1 if no such m exists.

Original entry on oeis.org

1, 1, -1, 2, 1, -1, 1, 1, -1, 1, 5, -1, 1, 1, -1, 2, 1, -1, 1, 2, -1, 1, 1, -1, 3, 1, -1, 4, 2, -1, 28, 2, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 1, 1, -1, 16, 1, -1, 1, 1, -1, 3, 2, -1, 5, 1, -1, 15, 1, -1, 1, 2, -1, 12, 1, -1, 4, 2, -1, 1, 1, -1, 1, 2, -1, 1, 3
Offset: 1

Views

Author

Toshitaka Suzuki, May 27 2024

Keywords

Comments

a(n) = -1 when n = 3*k because no matter how many 9's are appended to n, the resulting number is always divisible by 3 and therefore cannot be prime.
a(n) = -1 when n = 37037*k + 8424, 10175, 10998, 12210, 17600, 19360, 25826, 27146, 27685, 27861, 35915 or 36047, because n followed by any positive number, m say, of 9's is divisible by at least one of the primes {7,11,13,37}.
a(4420) > 300000 or a(4420) = -1.

Examples

			a(25)=3 because 259 and 2599 are composite but 25999 is prime.
		

Crossrefs

A358154 a(n) is the smallest composite number obtained by appending one or more 1's to n.

Original entry on oeis.org

111, 21, 3111, 411, 51, 611, 711, 81, 91, 1011, 111, 121, 1311, 141, 15111, 161, 171, 18111, 1911, 201, 21111, 221, 231, 24111, 2511, 261, 27111, 2811, 291, 301, 3111, 321, 3311, 341, 351, 361, 371, 381, 391, 4011, 411, 42111, 4311, 441, 451, 4611, 471, 481, 4911, 501, 511, 5211, 531, 5411
Offset: 1

Views

Author

Gleb Ivanov, Nov 01 2022

Keywords

Comments

a(n) is either 10*n+1, 100*n+11 or 1000*n+111, because at least one of these is divisible by 3. - Robert Israel, Nov 01 2022
Actually: exactly one of these is divisible by 3. Almost all terms are a(n) = 10n + 1: this is the case for about (k-1)/k of the terms up to 10^k (i.e., 69% ~ 2/3 up to 10^3, 76% = 3/4 up to 10^4, 80% = 4/5 up to 10^5, 83% = 5/6 up to 10^6). - M. F. Hasler, Nov 03 2022

Crossrefs

Programs

  • Maple
    f:= proc(n) local x;
       x:= n;
       do
         x:= 10*x+1;
         if not isprime(x) then return x fi;
       od
    end proc:
    map(f, [$1..100]); # Robert Israel, Nov 01 2022
  • Mathematica
    a[n_] := NestWhile[10*# + 1 &, 10*n + 1, ! CompositeQ[#] &]; Array[a, 54] (* Amiram Eldar, Nov 01 2022 *)
  • PARI
    a(n) = my(d=digits(n), m); if (!isprime(n), d = concat(d, 1)); while(isprime(m=fromdigits(d)), d=concat(d, 1)); m; \\ Michel Marcus, Nov 01 2022
  • Python
    from sympy import isprime
    def A358154(n):
        t = str(n)+'1'
        while isprime(int(t)):t=t+'1'
        return int(t)
    print([A358154(i) for i in range(1, 100)])
    
Showing 1-7 of 7 results.