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

A089392 Magnanimous primes: primes with the property that inserting a "+" in any place between two digits yields a sum which is prime.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 227, 229, 281, 401, 443, 449, 467, 601, 607, 647, 661, 683, 809, 821, 863, 881, 2221, 2267, 2281, 2447, 4001, 4027, 4229, 4463, 4643, 6007, 6067, 6803, 8009, 8221, 8821, 20261, 24407, 26881, 28429, 40427
Offset: 1

Views

Author

Amarnath Murthy, Nov 10 2003

Keywords

Comments

Original definition: Let the digits of n be abcd. Then bcd+a, cd+ab, d+abc, abcd, etc. must all be primes. If n is a k-digit number then it must produce k such primes.
Partition the digits of n into two groups by placing a '+' sign anywhere inside; the result of the expression is prime in every case. Conjecture: sequence is infinite. 11 is the largest term with all odd digits. 2 is the only member with all even digits. Observation: all two-digit primes with the most significant digit even are members.
In contradiction to the above conjecture, it is rather expected that this sequence is finite, cf. the link to C. Rivera's "Puzzle 401", and G. Resta's web page. Concerning the statement about 2 and 11, one can say that all terms except 2, 11 and 101 consist of even digits followed by a final odd digit. - M. F. Hasler, Dec 25 2014
Primes among the magnanimous numbers A252996. - M. F. Hasler, Dec 25 2014

Examples

			2267 is a member which gives primes 2+267 = 269, 22+67 = 89, 226+7 = 233 and 2267 itself.
		

Crossrefs

Programs

  • Maple
    with(combinat): ds:=proc(s) local j: RETURN(add(s[j]*10^(j-1),j=1..nops(s))):end: for d from 1 to 6 do sch:=[seq([1,op(i),d+1],i=[[],seq([j],j=2..d)])]: for n from 10^(d-1) to 10^d-1 do sn:=convert(n,base,10): fl:=0: for s in sch do m:=add(j,j=[seq(ds(sn[s[i]..s[i+1]-1]),i=1..nops(s)-1)]): if not isprime(m) then fl:=1: break fi od: if fl=0 then printf("%d, ",n) fi od od: # C. Ronaldo
  • Mathematica
    mpQ[n_]:=Module[{idn=IntegerDigits[n],len},len=Length[idn];And@@PrimeQ[ Table[ FromDigits[Take[idn,i]]+FromDigits[Take[idn,-(len-i)]],{i,len}]]]; Select[Range[41000],mpQ] (* Harvey P. Dale, Nov 06 2013 *)
  • PARI
    is_A089392(n)={!for(i=1,#Str(n),ispseudoprime([1,1]*(divrem(n,10^i)))||return)} \\ M. F. Hasler, Dec 25 2014
    
  • Python
    from sympy import isprime
    def ok(n):
        if not isprime(n): return False
        s = str(n)
        return all(isprime(int(s[:i])+int(s[i:])) for i in range(1, len(s)))
    print([k for k in range(357) if ok(k)]) # Michael S. Branicky, Oct 14 2024

Extensions

Corrected and extended by C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004
Comments edited by Zak Seidov, Jan 29 2013
Edited by M. F. Hasler, Dec 25 2014

A089393 Smallest n-digit magnanimous prime (A089392), or 0 if there is no such prime with n digits.

Original entry on oeis.org

2, 11, 101, 2221, 20261, 220021, 2000221, 20266681, 228440489, 0, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Amarnath Murthy, Nov 10 2003

Keywords

Comments

A089392 has no members with 10, 11, or 12 digits. It is unlikely that it has any with more than 12 digits. - David Wasserman, Sep 15 2005
Giovanni Resta has checked this up to 16 digits, see Carlos Rivera's puzzle page for a probabilistic argument. - M. F. Hasler, Dec 28 2014

Crossrefs

Programs

  • Maple
    with(combinat): ds:=proc(s) local j: RETURN(add(s[j]*10^(j-1),j=1..nops(s))):end: for d from 1 to 10 do sch:=[seq([1,op(i),d+1],i=[[],seq([j],j=2..d)])]: for n from 10^(d-1) to 10^d-1 do sn:=convert(n,base,10): fl:=0: for s in sch do m:=add(j,j=[seq(ds(sn[s[i]..s[i+1]-1]),i=1..nops(s)-1)]): if not isprime(m) then fl:=1: break fi od: if fl=0 then printf("%d, ",n):break fi od od: # C. Ronaldo

Extensions

a(5) and a(6) from Mark Hudson (mrmarkhudson(AT)hotmail.com), Dec 15 2004
Corrected and extended by C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004
Two more terms from David Wasserman, Sep 15 2005
Definition edited and a(10..16) = 0 added by M. F. Hasler, Dec 28 2014

A252996 Magnanimous numbers: numbers such that the sum obtained by inserting a "+" anywhere between two digits gives a prime.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 49, 50, 52, 56, 58, 61, 65, 67, 70, 74, 76, 83, 85, 89, 92, 94, 98, 101, 110, 112, 116, 118, 130, 136, 152, 158, 170, 172, 203, 209, 221, 227, 229, 245, 265, 281, 310, 316, 334, 338, 356
Offset: 1

Views

Author

M. F. Hasler, Dec 25 2014

Keywords

Comments

Inclusion of the single-digit terms is conventional: here the property is voidly satisfied since no sum can be constructed by inserting a + sign between two digits, therefore all possible sums are prime. (It is not allowed to prefix a leading zero (e.g., to forbid 4 = 04 = 0+4) since in that case all terms must be prime and one would get A089392.)
All terms different from 20 and not of the form 10^k+1 have the last digit of opposite parity than that of all other digits.
The sequence is marked as "finite", although we do not have a rigorous proof for this, only very strong evidence (numerical and probabilistic). G. Resta has checked that up to 5e16 the only magnanimous numbers with more than 11 digits are 5391391551358 and 97393713331910, the latter being probably the largest element of this sequence. In that case the 10+33+79+104+112+96+71+35+18+6+5+0+1+1 = 571 terms listed in Wilson's b-file are the complete list, which is what the keyword "full" stands for.

Examples

			245 is in the sequence because the numbers 2 + 45 = 47 and 24 + 5 = 29 are both prime. See the first comment for the single-digit terms.
		

Crossrefs

Programs

  • Maple
    filter:= proc(n) local d;
      for d from 1 to ilog10(n)-1 do
        if not isprime(floor(n/10^d)+(n mod 10^d)) then return false fi
      od:
      true
    end proc:
    select(filter, [$0..10^5]); # Robert Israel, Dec 25 2014
  • Mathematica
    fQ[n_] := Block[{idn = IntegerDigits@ n, lng = Floor@ Log10@ n}, Union@ PrimeQ@ Table[ FromDigits[ Take[ idn, i]] + FromDigits[ Take[ idn, -lng + i -1]], {i, lng}] == {True}]; (* or *)
    fQ[n_] := Block[{lng = Floor@ Log10@ n}, Union@ PrimeQ[ Table[ Floor[n/10^k] + Mod[n, 10^k], {k, lng}]] == {True}];
    fQ[2] = fQ[3] = fQ[5] = fQ[7] = True; Select[ Range@ 500, fQ]
    (* Robert G. Wilson v, Dec 26 2014 *)
    mnQ[n_]:=AllTrue[Total/@Table[FromDigits/@TakeDrop[IntegerDigits[n],i],{i,IntegerLength[n]-1}],PrimeQ]; Join[Range[0,9],Select[Range[ 10,400], mnQ]] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, May 26 2017 *)
  • PARI
    is(n)={!for(i=1,#Str(n)-1,ispseudoprime([1,1]*(divrem(n,10^i)))||return)}
    t=0;vector(100,i,until(is(t++),);t)
    
  • Python
    from sympy import isprime
    def ok(n):
        s = str(n)
        return all(isprime(int(s[:i])+int(s[i:])) for i in range(1, len(s)))
    print([k for k in range(357) if ok(k)]) # Michael S. Branicky, Oct 14 2024

A089395 Prime productive numbers m: Let the digits of m be abcd. Then the numbers bcd*a+1, cd*ab+1, d*abc+1, abcd+1 etc. are all primes. If m is a k-digit number it produces k such primes.

Original entry on oeis.org

1, 2, 4, 6, 12, 16, 22, 28, 36, 52, 58, 66, 82, 106, 112, 136, 166, 178, 256, 306, 336, 352, 448, 502, 508, 556, 562, 586, 616, 652, 658, 718, 982, 1018, 1108, 1162, 1192, 1228, 1498, 1708, 2002, 2026, 2086, 2686, 2776, 2998, 3136, 3412, 3526, 3592, 4078, 4918
Offset: 0

Views

Author

Amarnath Murthy, Nov 10 2003

Keywords

Comments

Conjecture: Sequence is infinite.

Examples

			256 is a term as 2*56 + 1 = 113, 25*6 + 1 = 151 and 256 + 1 = 257 are all primes.
		

Crossrefs

Programs

  • Maple
    with(combinat): ds:=proc(s) local j: RETURN(add(s[j]*10^(j-1),j=1..nops(s))):end: for d from 1 to 6 do sch:=[seq([1,op(i),d+1],i=[[],seq([j],j=2..d)])]: for n from 10^(d-1) to 10^d-1 do sn:=convert(n,base,10): fl:=0: for s in sch do m:=mul(j,j=[seq(ds(sn[s[i]..s[i+1]-1]),i=1..nops(s)-1)])+1: if not isprime(m) then fl:=1: break fi od: if fl=0 then printf("%d, ",n) fi od od: # C. Ronaldo
  • Mathematica
    ppnQ[n_]:=Mod[n,10]!=0&&AllTrue[Times@@@Table[FromDigits/@TakeDrop[ IntegerDigits[ n],k]/.(0->1),{k,IntegerLength[n]}]+1,PrimeQ]; Select[Range[5000], ppnQ] (* The program uses the AllTrue and TakeDrop functions from Mathematica version 10 *) (* Harvey P. Dale, Mar 23 2019 *)

Extensions

Corrected and extended by C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004

A252495 Restricted magnanimous numbers: numbers such that the sum obtained by inserting a "+" anywhere between two digits gives a prime, but no "leading zeros" may appear.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 14, 16, 20, 21, 23, 25, 29, 30, 32, 34, 38, 41, 43, 47, 49, 50, 52, 56, 58, 61, 65, 67, 70, 74, 76, 83, 85, 89, 92, 94, 98, 110, 112, 116, 118, 130, 136, 152, 158, 170, 172, 221, 227, 229, 245, 265, 281, 310, 316, 334, 338, 356
Offset: 1

Views

Author

M. F. Hasler, Dec 28 2014

Keywords

Comments

Inclusion of the single-digit terms is conventional: here the property is vacuously satisfied since no sum can be constructed by inserting a + sign between two digits, therefore all possible sums are prime. (It is not allowed to prefix a leading zero (e.g., to forbid 4 = 04 = 0+4) since in that case all terms must be prime and one would get A089392.)
The restriction on leading zeros means that numbers with digit 0 other than in the last position are excluded, so this sequence equals A252996 with terms in A252480 removed.
Since all primes > 2 are odd, all terms different from 11 and 20 have the last digit of opposite parity to that of all other digits.
As A252996, this sequence is "finite" (without rigorous proof), and up to 5e16 the only terms with more than 11 digits are 5391391551358 and 97393713331910, the latter being probably the largest element of this sequence (due to Giovanni Resta).
(See links for "intellectual ownership": The sequence (without single-digit terms) was suggested by Eric Angelini, a first list of terms computed by Lars Blomberg, then others. Hans Havermann observed that this is a variant of what had been termed "magnanimous numbers" at least 10 years ago by A. Murthy, G. Resta and/or C. Rivera, cf. A089392 and links.)

Examples

			110 is in the sequence since 1+10=11 and 11+0 = 11 are both prime.
101 is not in the sequence because although 10+1 = 11 and 1+01 = 2 are prime, the latter sum is forbidden since 01 has a leading zero.
Number, smallest and largest of the n-digit terms:
| n   #     min    max
| 1  10      0      9
| 2  33      11     98
| 3  69     110     998
| 4  90     1112    9910
| 5  81    11116    99998
| 6  71    111112   999994
| 7  54   1115756   9959374
| 8  25   11771992  95559998
| 9   9  117711170  995955112
|10   4  1777137770 9151995592
|11   4 22226226625 46884486265
|12   0  -
|13   1     5391391551358
|14   1     97393713331910
|15   0  -
		

Crossrefs

Programs

  • PARI
    is(n)=!for(i=1,#Str(n)-1,ispseudoprime([1,1]*(divrem(n,10^i)))||return)&&(n<100||vecmin(digits(n\10)))
    t=0;vector(100,i,until(is(t++),);t)

A089396 Smallest n-digit term of A089395.

Original entry on oeis.org

1, 12, 106, 1018, 10312, 105502, 1197058, 11056216
Offset: 0

Views

Author

Amarnath Murthy, Nov 10 2003

Keywords

Examples

			a(3) = 256 which is the smallest 3-digit number such that 2*56 + 1 = 113, 25*6 + 1 = 151 and 256 + 1 = 257 are all prime.
		

Crossrefs

Programs

  • Maple
    with(combinat): ds:=proc(s) local j: RETURN(add(s[j]*10^(j-1),j=1..nops(s))):end: for d from 1 to 7 do sch:=[seq([1,op(i),d+1],i=[[],seq([j],j=2..d)])]: for n from 10^(d-1) to 10^d-1 do sn:=convert(n,base,10): fl:=0: for s in sch do m:=mul(j,j=[seq(ds(sn[s[i]..s[i+1]-1]),i=1..nops(s)-1)])+1: if not isprime(m) then fl:=1: break fi od: if fl=0 then printf("%d, ",n):break fi od od: # C. Ronaldo

Extensions

Corrected and extended by C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004
One more term (a(7)) from Harvey P. Dale, Mar 23 2019

A089397 Largest n-digit member of A089395.

Original entry on oeis.org

6, 82, 982, 9748, 96052, 992548
Offset: 1

Views

Author

Amarnath Murthy, Nov 10 2003

Keywords

Crossrefs

Programs

  • Maple
    with(combinat): ds:=proc(s) local j: RETURN(add(s[j]*10^(j-1),j=1..nops(s))):end: for d from 1 to 6 do sch:=[seq([1,op(i),d+1],i=[[],seq([j],j=2..d)])]: for n from 10^d-1 by -1 to 10^(d-1) do sn:=convert(n,base,10): fl:=0: for s in sch do m:=mul(j,j=[seq(ds(sn[s[i]..s[i+1]-1]),i=1..nops(s)-1)])+1: if not isprime(m) then fl:=1: break fi od: if fl=0 then printf("%d, ",n):break fi od od: # C. Ronaldo

Extensions

More terms from C. Ronaldo (aga_new_ac(AT)hotmail.com), Dec 25 2004

A211160 Number of n-digit terms in A089392 (magnanimous primes).

Original entry on oeis.org

4, 10, 17, 15, 10, 15, 7, 2, 4, 0, 0, 0, 0, 0, 0
Offset: 1

Views

Author

Zak Seidov, Jan 30 2013

Keywords

Comments

Apparently all next terms are zero.

Examples

			a(1) = 4: 2, 3, 5, 7.
a(2) = 10: 11, 23, 29, 41, 43, 47, 61, 67, 83, 89.
a(8) = 2: 20266681, 48804809.
a(9) = 4: 228440489, 244064027, 606202627, 608844043.
		

Crossrefs

Extensions

a(13)-a(15) from Donovan Johnson, Feb 17 2013
Showing 1-8 of 8 results.