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

A245759 Primes p such that concatenation of p with its digit sum is also prime.

Original entry on oeis.org

61, 83, 137, 139, 197, 199, 223, 241, 281, 313, 337, 353, 373, 397, 421, 449, 557, 577, 647, 719, 773, 809, 881, 937, 953, 971, 991, 1033, 1039, 1091, 1093, 1097, 1129, 1187, 1217, 1277, 1291, 1297, 1303, 1321, 1361, 1381, 1523, 1543, 1567, 1657, 1693, 1723, 1907
Offset: 1

Views

Author

K. D. Bajpai, Jul 31 2014

Keywords

Examples

			61 is in the sequence because it is prime and the concatenation[ 61 with (6 + 1)] = 617 is also prime.
197 is in the sequence because it is prime and the concatenation[ 197 with (1 + 9 + 7)] = 19717 is also prime.
		

Crossrefs

Programs

  • Maple
    with(StringTools): A245759 := proc() local a, b, d, e; a:=ithprime(m); b:=add( i,i = convert((a), base, 10))(a); d:=parse(cat(a, b)); e:= parse(cat(b, a)); if isprime(d) then RETURN (a); fi; end: seq(A245759 (), m=1..1000);
  • PARI
    for(n=1,10^3,p=prime(n);if(isprime(eval(concat(Str(p),Str(sumdigits(p))))),print1(p,", "))) \\ Derek Orr, Jul 31 2014

A281571 Smallest k such that (the base-2 number formed by concatenating k consecutive base-2 numbers starting at n) is prime, or 0 if no such k exists.

Original entry on oeis.org

15, 1, 1, 2, 1, 26, 1, 2, 31
Offset: 1

Views

Author

Paolo P. Lava, Jan 24 2017

Keywords

Comments

The first primes reached are 485398038695407, 2, 3, 37, 5, 288368629084891241583296816292460511, 7, 137, 55212283888448697916635329662406145945631873447, ...
Except for the second term, n and a(n) have the same parity, i.e., a(n) == n (mod 2). Is it proved (or can it be disproved) that the required k exists for all n? a(10), a(21), a(24), a(38), a(52), a(55) are larger than 1500, if they exist. - M. F. Hasler, Apr 26 2017
a(10) > 40000. Terms at indices 24, 38, 55, 56, 57, 60, 62, 65, 66, 76, 78, 91, 92, 95 are > 20000. A large known term is a(330) = 9376. - Hans Havermann, May 17 2017

Examples

			a(1) = 15 because we have to concatenate the base-2 numbers from 1 to 15 to reach the first prime. In fact concat(1, 10, 11, 100, 101, 110, 111, 1000, 1001, 1010, 1011, 1100, 1101, 1110, 1111) =
1101110010111011110001001101010111100110111101111, which is prime (in base 10 it is 485398038695407).
		

Crossrefs

Cf. A244424 for the base-10 variant.

Programs

  • Maple
    P:=proc(q) local a,b,k,n; for n from 1 to q do
    if isprime(n) then print(1); else a:=convert(n,binary,decimal);
    for k from n+1 to q do b:=convert(k,binary,decimal); a:=a*10^(ilog10(b)+1)+b; if isprime(convert(a,decimal,binary))
    then print(k-n+1); break; fi; od; fi; od; end: P(10^10);
  • Mathematica
    With[{nn = 2^10}, Table[Module[{k = n, w = IntegerDigits[n, 2]}, While[And[! PrimeQ[FromDigits[w, 2]], k - n < nn], k++; w = Join[w, IntegerDigits[k, 2]]]; If[k - n >= nn, -1, k - n + 1]], {n, 50}]] (* Michael De Vlieger, Apr 26 2017, with -1 indicating values of k > limit nn *)
  • PARI
    a(n,c=1,m=n)=while(!ispseudoprime(n),c++;n=n<<#binary(m++)+m);c

Formula

a(n) = 1 if n is prime.

Extensions

Edited by Max Alekseyev, Apr 26 2017.
Further edits from N. J. A. Sloane, Apr 26 2017
a(18) = 586, a(28) = 934, a(35) = 947, a(51) = 1325 (PRP), and further edits from M. F. Hasler, Apr 26 2017

A245763 Primes p such that the concatenation of p with its digit sum and the concatenation of the digit sum of p with p are both prime.

Original entry on oeis.org

61, 337, 353, 449, 577, 881, 937, 971, 991, 1091, 1129, 1217, 1297, 1381, 1543, 1657, 1693, 2069, 2137, 2539, 2621, 2791, 3347, 3727, 3943, 4157, 4201, 4243, 4513, 4861, 5077, 5431, 5701, 5927, 6043, 6317, 6353, 6421, 6449, 6661, 6917, 7109, 7127, 7507, 7547
Offset: 1

Views

Author

K. D. Bajpai, Jul 31 2014

Keywords

Comments

Intersection of A246428 and A245759.

Examples

			61 is in the sequence because it is prime; concatenation[61 with (6 + 1)] = 617 is prime and concatenation[(6 + 1) with 61] = 761 is also prime.
337 is in the sequence because it is prime; concatenation[337 with (3 + 3 + 7)] = 33713 is prime and concatenation[(3 + 3 + 7) with 337] = 13337 is also prime.
		

Crossrefs

Programs

  • Maple
    with(StringTools): A245763 := proc() local a, b, d, e; a:=ithprime(n); b:=add( i,i = convert((a), base, 10))(a); d:=parse(cat(a, b)); e:= parse(cat(b, a)); if isprime(d)and isprime(e) then RETURN (a); fi; end: seq(A245763 (), n=1..2000);
  • Mathematica
    cdsQ[n_]:=Module[{ds=Total[IntegerDigits[n]]},AllTrue[ {n*10^IntegerLength[ ds]+ ds, ds*10^IntegerLength[ n]+n},PrimeQ]]; Select[Prime[Range[1100]],cdsQ] (* The program uses the AllTrue function from Mathematica version 10 *) (* Harvey P. Dale, Sep 23 2016 *)
  • PARI
    for(n=1,10^4,p=prime(n);d=Str(sumdigits(p));if(isprime(eval(concat(Str(p),d)))&&isprime(eval(concat(d,Str(p)))),print1(p,", "))) \\ Derek Orr, Jul 31 2014
    
  • Python
    from sympy import prime, isprime
    A245763 = [int(n) for n in (str(prime(x)) for x in range(1,10**3))
              if isprime(int(str(sum([int(d) for d in n]))+n)) and
              isprime(int(n+str(sum([int(d) for d in n]))))]
    # Chai Wah Wu, Aug 27 2014
Showing 1-3 of 3 results.