login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A241100 Smallest prime with length n having at least n-1 identical digits. 9

%I #25 Dec 29 2015 19:53:15

%S 2,11,101,1117,10111,101111,1111151,11110111,101111111,1111111121,

%T 11111111113,101111111111,1111111118111,11111111111411,

%U 111111111116111,1111111111111181,11111111101111111,101111111111111111,1111111111111111111,11011111111111111111

%N Smallest prime with length n having at least n-1 identical digits.

%C Conjecture: each term consists of at least n-1 digits 1. - _Chai Wah Wu_, Dec 10 2015

%C From _Robert G. Wilson v_, Dec 14 2015: (Start)

%C Terms for which the digit d is the other digit besides the 1's:

%C d:

%C 0: 3, 5, 6, 8, 9, 12, 17, 18, 20, 24, 26, 29, 30, 32, 33, 35, 36, 38, 39, 42, ..., ; n cannot be congruent to 1 (mod 3);

%C 1: 2, 19, 23, not 317, nor 1031, ..., (see A004023); n cannot be congruent to 0 (mod 3)

%C 2: 1, 10, 34, 46, 67, 75, 100, 103, 142, 148, 154, 175, 198, 232, 244, 274, ..., ;

%C 3: 11, 63, 69, 71, 87, 123, 125, 165, 191, 197, 203, 239, 254, 255, 275, 279, ..., ;

%C 4: 14, 31, 55, 76, 85, 91, 95, 109, 121, 127, 130, 143, 155, 163, 166, 178, ..., ;

%C 5: 7, 22, 28, 37, 45, 52, 60, 94, 111, 132, 133, 139, 159, 160, 172, 184, ..., ;

%C 6: 15, 41, 57, 59, 135, 156, 171, 213, 311, 336, 339, 345, 347, 350, 431, ..., ;

%C 7: 4, 40, 47, 58, 64, 70, 101, 106, 112, 115, 118, 131, 136, 145, 157, 169, ..., ;

%C 8: 13, 16, 25, 43, 49, 61, 73, 79, 82, 88, 93, 97, 99, 117, 124, 141, 151, ..., ;

%C 9: 21, 27, 65, 81, 119, 167, 179, 183, 189, 237, 242, 287, 299, 333, 356, ..., . (End)

%H Chai Wah Wu, <a href="/A241100/b241100.txt">Table of n, a(n) for n = 1..1000</a>

%p with(numtheory):lst:={}:nn:=80:kk:=0:T:=array(1..nn):U:=array(1..20):

%p for n from 2 to nn do:

%p for i from 1 to n do:

%p T[i]:=1:

%p od:

%p ii:=0:

%p for k from 0 to 9 while(ii=0)do:

%p for j from 1 to n while(ii=0)do:

%p T[j]:=k:s:=sum('T[i]*10^(n-i)', 'i'=1..n):

%p if type(s,prime)=true and length(s)=n

%p then

%p ii:=1: kk:=kk+1:U[kk]:=s:

%p else

%p T[j]:=1:

%p fi:

%p od:

%p od:

%p od :

%p print(U) :

%t f[n_] := Block[{k = n - 2, p = 0, r = (10^n - 1)/9, s}, If[ Mod[n, 3] != 1, While[p = r - 10^k; k > 0 && ! PrimeQ@ p, k--]]; If[ Mod[p, 10] == 0, k = 0; s = Select[Range[0, 8], Mod[# + n, 3] > 0 &]; While[p = Select[r + 10^k*s, PrimeQ]; k < n && p == {}, k++]]; p = Min@ p]; Array[f, 20] (* _Robert G. Wilson v_, Dec 14 2015 *)

%o (Python)

%o from __future__ import division

%o from sympy import isprime

%o def A241100(n):

%o for i in range(1,10):

%o x = i*(10**n-1)//9

%o for j in range(n-1,-1,-1):

%o for k in range(i,-1,-1):

%o if j < n-1 or k < i:

%o y = x-k*(10**j)

%o if isprime(y):

%o return y

%o for j in range(n):

%o for k in range(1,9-i+1):

%o y = x+k*(10**j)

%o if isprime(y):

%o return y # _Chai Wah Wu_, Dec 29 2015

%K nonn,base

%O 1,1

%A _Michel Lagneau_, Apr 16 2014

%E a(4), a(7), a(10), a(11), a(13)-a(16) corrected by _Chai Wah Wu_, Dec 10 2015

%E a(1) from _Robert G. Wilson v_, Dec 11 2015

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified March 28 10:55 EDT 2024. Contains 371241 sequences. (Running on oeis4.)