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

A086002 Primes which when added to their own rotation yield a prime.

Original entry on oeis.org

229, 239, 241, 257, 269, 271, 277, 281, 439, 443, 463, 467, 479, 499, 613, 641, 653, 661, 673, 677, 683, 691, 811, 823, 839, 863, 881, 10111, 10151, 10169, 10181, 10243, 10247, 10253, 10267, 10303, 10313, 10331, 10343, 10391, 10429, 10453, 10457
Offset: 1

Views

Author

Chuck Seggelin, Jul 07 2003

Keywords

Comments

Let rotation rot(k) of a number k be defined by swapping the blocks of the first [d/2] and of the last [d/2] digits of k, where d=A055642(k). If the number of digits in k is odd, the center digit remains untouched during rotation.
So for example the rotation of 1234 is 3412, while the rotation of 12345 is 45312.
Rotation differs from reversal (A004086) for numbers with at least 4 digits, that is, after A004087(168) if we are concerned with primes.
The sequence lists primes p such that p+rot(p) is (again) prime.
Differs from A061783, where rot(k) is replaced by reverse(k), from the 5-digit terms on. - M. F. Hasler, Mar 03 2011
a(n) has an odd number of digits (see RJM comment in A086004). If a(n) has 2m+1 digits, then the m-th digit of a(n) is even as otherwise a(n) + rot(a(n)) is even. - Chai Wah Wu, Aug 19 2015

Examples

			a(100)=12917 because (i) 12917 is prime and (ii) rotate(12917) = 17912 and 12917+17912=30829, which is also prime.
		

Crossrefs

Programs

  • Maple
    A055642 := proc(n) max(1,1+ilog10(n)) ; end:
    rot := proc(n) local d,dl,dh,pre,suf ; d := A055642(n) ; dl := floor( d/2) ; dh := floor( (d+1)/2) ; pre := floor(n/10^dh) ; suf := n mod 10^dl ; if dl <> dh then suf*10^dh+pre+10^dl*( floor(n/10^dl) mod 10) ; else suf*10^dh+pre ; fi; end:
    isA086002 := proc(p) if isprime(p) then isprime(p+rot(p)) ; else false; fi; end:
    for n from 1 to 1500 do p := ithprime(n) ; if isA086002(p) then printf("%d,",p) ; fi; od: # R. J. Mathar, May 27 2009
  • Mathematica
    rot[n_]:=Module[{idn=IntegerDigits[n],len},len=Length[idn];If[OddQ[len],FromDigits[ Join[Take[idn,-Floor[len/2]],{idn[[(len+1)/2]]},Take[idn,Floor[len/2]]]],FromDigits[ Join[ Take[ idn,-len/2],Take[idn,len/2]]]]]; Select[Prime[Range[1500]],PrimeQ[ #+rot[#]]&] (* Harvey P. Dale, Apr 26 2022 *)

Extensions

Edited by R. J. Mathar, May 27 2009

A367796 Primes p such that the sum of p and its reversal is the square of a prime.

Original entry on oeis.org

2, 29, 47, 83, 20147, 23117, 24107, 63113, 80141, 81131, 261104399, 262005299, 262104299, 262203299, 263302199, 264203099, 264302099, 264500099, 270401489, 271500389, 273104189, 273302189, 274401089, 282203279, 284302079, 284500079, 291104369, 291203369, 292005269, 293005169, 293104169, 294302069
Offset: 1

Views

Author

Robert Israel, Nov 30 2023

Keywords

Comments

Terms > 83 have an odd number of digits and an even first digit.

Examples

			A056964(a(n)) = 121 = 11^2 for 2 <= n <= 4.
A056964(a(n)) = 94249 = 307^2 for 5 <= n <= 10.
A056964(a(n)) = 1254505561 = 35419^2 for 11 <= n <= 71.
		

Crossrefs

Cf. A056964, A067030, A061783. Subset of A367793.

Programs

  • Maple
    digrev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    filter:= proc(t) local v;
      v:= sqrt(t+digrev(t));
      v::integer and isprime(v)
    end proc:
    R:= 2, 29, 47, 83: count:= 4: flag:= true:
    for d from 3 to 9 by 2 do
      p:= prevprime(10^(d-1));
      for i from 1 do
        p:= nextprime(p);
        p1:= floor(p/10^(d-1));
        if p1::odd then p:= nextprime((p1+1)*10^(d-1)) fi;
        if p > 10^d then break fi;
        if filter(p) then
           count:= count+1; R:= R,p;
    fi od od:
    R;
  • Mathematica
    Select[Prime[Range[10^6]], PrimeQ[Sqrt[#+FromDigits[Reverse[IntegerDigits[#]]]]] &] (* Stefano Spezia, Dec 10 2023 *)
  • PARI
    \\ See PARI link

A072385 Primes which can be represented as the sum of a prime and its reverse.

Original entry on oeis.org

383, 443, 463, 787, 827, 887, 929, 1009, 1049, 1069, 1151, 1171, 1231, 1373, 1453, 1493, 1777, 30203, 30403, 31013, 32213, 32413, 32423, 33023, 33223, 34033, 34843, 35053, 36263, 36653, 37273, 37463, 37663, 38083, 38273, 38873, 39293, 39883
Offset: 1

Views

Author

Shyam Sunder Gupta, Jul 20 2002

Keywords

Comments

This set is the image under the "reverse and add" operation (A056964) of the Luhn primes A061783 (which remain prime under that operation). Those have always an odd number of digits, and start with an even digit. Therefore this sequence has its terms in intervals [3,20]*100^k with k = 1, 2, 3.... - M. F. Hasler, Sep 26 2019

Examples

			383 is a term because it is prime and it is the sum of prime 241 and its reverse 142.
		

Crossrefs

Cf. A004086 (reverse), A004087 (primes reversed), A056964 (reverse & add), A061783 (Luhn primes), A086002 (similar, using "rotate" instead of "reverse").

Programs

  • Mathematica
    f@n_:=(Select[# + IntegerReverse[#] & /@ Prime[Range[n]], PrimeQ@# && # <= Prime[n] &] // Union); f@3000 (* Harvey P. Dale, Jul 18 2018; corrected by Hans Rudolf Widmer, Aug 15 2024 *)
  • PARI
    is_A072385(p)={isprime(p)&&forprime(q=p\10,p*9\10,A056964(q)==p&&return(1))} \\ A056964(n)=n+fromdigits(Vecrev(digits(n))). It is much faster to produce the terms as shown below, rather than to "select" them from a range of primes. - M. F. Hasler, Sep 26 2019
    
  • PARI
    A072385=Set(apply(A056964, A061783)) \\ with, e.g.: A061783=select(is_A061783(p)={isprime(A056964(p))&&isprime(p)}, primes(8713)) - M. F. Hasler, Sep 26 2019

Formula

a(n) = A056964(A061783(n)). - M. F. Hasler, Sep 26 2019

Extensions

Cross-references added by M. F. Hasler, Sep 26 2019

A232446 Primes p such that reversal( p^2 ) + p is also prime.

Original entry on oeis.org

7, 151, 787, 1549, 1579, 2029, 2083, 2179, 2833, 2971, 4549, 4591, 4801, 4999, 5077, 5167, 5179, 5209, 5227, 5407, 6343, 6529, 6547, 6553, 6577, 6679, 7027, 7753, 7867, 7873, 7927, 7963, 7993, 8167, 8191, 8311, 9091, 9103, 9151, 9283, 14251, 14281, 14389, 14437
Offset: 1

Views

Author

K. D. Bajpai, Nov 24 2013

Keywords

Examples

			a(1)= 7, it is prime: prime(4)= 7: reversal(7^2)+7= reversal(49)+7= 94+7= 101 which is also prime.
a(2)= 151, it is prime: prime(36)= 151: reversal(151^2)+151= reversal(22801)+151=10822+151= 10973 which is also prime.
		

Crossrefs

Cf. A061783 (primes p: p+(p reversed) is also prime).
Function reversal is given by A004086. Cf. also A004087.

Programs

  • Maple
    with(StringTools): KD:= proc() local a,p; p:=ithprime(n);a:= parse(Reverse(convert((p^2), string)))+p; if isprime(a) then RETURN (p): fi; end: seq(KD(), n=1..3000);
  • Mathematica
    Select[Prime[Range[3000]], PrimeQ[# + FromDigits[Reverse[IntegerDigits[#^2]]]] &]

A304390 Prime numbers p such that p squared + (p reversed) squared is also prime.

Original entry on oeis.org

23, 41, 227, 233, 283, 401, 409, 419, 421, 461, 491, 499, 823, 827, 857, 877, 2003, 2083, 2267, 2437, 2557, 2593, 2617, 2633, 2677, 2857, 2887, 2957, 4001, 4021, 4051, 4079, 4129, 4211, 4231, 4391, 4409, 4451, 4481, 4519, 4591, 4621, 4639, 4651, 4871, 6091, 6301, 6329, 6379, 6521, 6529, 6551
Offset: 1

Views

Author

Pierandrea Formusa, Aug 16 2018

Keywords

Examples

			The prime number 227 belongs to this sequence as 722 is 227 reversed and 227^2 + 722^2 = 572813, which is prime.
		

Crossrefs

Cf. A061783 (Luhn primes).
Subsequence of A069207. - Michel Marcus, Aug 21 2018

Programs

  • Mathematica
    Select[Prime@ Range@ 850, PrimeQ[#^2 + FromDigits[ Reverse@ IntegerDigits@ #]^2] &] (* Giovanni Resta, Sep 03 2018 *)
  • PARI
    isok(p) = isprime(p) && isprime(p^2+eval(fromdigits(Vecrev(digits(p))))^2); \\ Michel Marcus, Aug 21 2018
  • Python
    nmax=10000
    def is_prime(num):
        if num == 0 or num == 1: return(0)
        for k in range(2, num):
           if (num % k) == 0:
               return(0)
        return(1)
    ris = ""
    for i in range(nmax):
        r=int((str(i)[::-1]))
        t=pow(i,2)+pow(r,2)
        if is_prime(i):
           if is_prime(t):
              ris = ris+str(i)+","
    print(ris)
    

A367793 Primes p such that the sum of p and its reversal is a semiprime.

Original entry on oeis.org

2, 3, 5, 7, 11, 23, 29, 41, 43, 47, 61, 67, 83, 89, 101, 131, 151, 181, 191, 211, 223, 227, 233, 251, 293, 313, 353, 373, 383, 401, 409, 419, 421, 431, 433, 449, 457, 487, 491, 571, 599, 601, 607, 617, 619, 631, 643, 647, 727, 757, 787, 797, 809, 821, 827, 829, 853, 859, 877, 883, 919, 929, 2011
Offset: 1

Views

Author

Zak Seidov and Robert Israel, Nov 30 2023

Keywords

Comments

Terms > 11 with an even number of digits have an even first digit.

Examples

			a(6) = 23 is a term because 23 is a prime and 23 + 32 = 55 = 5 * 11 is a semiprime.
		

Crossrefs

Programs

  • Maple
    digrev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    select(p -> isprime(p) and numtheory:-bigomega(p+digrev(p))=2, [2,seq(i,i=3..10000,2)]);
  • Mathematica
    Select[Prime[Range[10^3]], 2 == PrimeOmega[# + FromDigits[Reverse[IntegerDigits[#]]]] &]

A174402 Primes such that applying "reverse and add" twice produces two more primes.

Original entry on oeis.org

271, 281, 21491, 21991, 22091, 22481, 23081, 23971, 24071, 25951, 26681, 26981, 27271, 27431, 27691, 27791, 28031, 28661, 28921, 28961, 29021, 29191, 29251, 29411, 29671, 2129891, 2131991, 2141791, 2141891, 2151791, 2157091, 2161591, 2179391, 2191291
Offset: 1

Views

Author

Harvey P. Dale, Nov 27 2010

Keywords

Comments

Some observations:
1. For all terms, the first digit is 2, last digit is 1, number of digits is odd: 3,5,7,...
2. The sequence is infinite. Number of 3-digit terms is 2, number of 5-digit terms is 23, number of 7-digit terms is 585, number of 9-digit terms is 26611.
3. Applying "reverse and add" a third time always produces composites. - Zak Seidov, Dec 09 2013

Examples

			21491 is included because (1) it is prime, and (2) 21491 + 19412 = 40903 which is prime, and (3) 40903 + 30904 = 71807 which also is prime.
		

Crossrefs

Cf. A061783.

Programs

  • Mathematica
    Transpose[Select[Table[{Prime[i],And@@PrimeQ/@NestList[#+FromDigits[ Reverse[ IntegerDigits[#]]]&,Prime[i],2]},{i,500000}],#[[2]] == True&]][[1]]
    tmpQ[p_]:=AllTrue[Rest[NestList[#+IntegerReverse[#]&,p,2]],PrimeQ]; Select[Prime[Range[163000]],tmpQ] (* Harvey P. Dale, Feb 05 2025 *)

A232655 Primes p such that reversal (p^2+p) is also prime.

Original entry on oeis.org

5, 13, 19, 103, 139, 181, 193, 271, 277, 313, 379, 433, 577, 619, 631, 853, 859, 883, 1093, 1117, 1123, 1237, 1279, 1321, 1741, 1873, 1933, 1987, 2659, 2707, 2713, 2719, 2767, 2791, 3163, 3217, 3271, 3331, 3469, 3529, 3547, 3631, 3637, 3727, 3907, 3943, 4129, 4177
Offset: 1

Views

Author

K. D. Bajpai, Nov 27 2013

Keywords

Examples

			a(2)= 13, it is prime: n= 6, prime(6)= 13: reversal(13^2+13)= 281, which is also prime.
a(4)= 103, it is prime: n= 27, prime(27)= 103: reversal(103^2+103)= 21701, which is also prime.
a(6)= 181, it is prime: n= 42, prime(42)= 181: reversal(181^2+181)= 24923, which is also prime.
		

Crossrefs

Cf. A004087 (primes written backwards).
Cf. A061783 (primes p: p+(p reversed)is also prime).
Cf. A232446 (primes p: reversal(p^2)+p is also prime).

Programs

  • Maple
    with(StringTools): KD:= proc() local a, p; p:=ithprime(n); a:= parse(Reverse(convert((p^2+p), string))); if isprime(a) then RETURN (p): fi; end: seq(KD(), n=1..3000);
  • Mathematica
    Select[Prime[Range[3000]], PrimeQ[FromDigits[Reverse[IntegerDigits[#^2 + #]]]] &]

A244392 Primes p such that p + (p reversed) is a palindrome.

Original entry on oeis.org

2, 3, 11, 13, 17, 23, 29, 31, 41, 43, 47, 53, 61, 71, 83, 101, 103, 107, 113, 127, 131, 137, 211, 223, 227, 233, 241, 311, 313, 331, 401, 421, 431, 433, 443, 503, 521, 523, 541, 601, 613, 631, 641, 643, 701, 811, 821, 1013, 1021, 1031, 1033, 1051, 1061, 1063
Offset: 1

Views

Author

Vincenzo Librandi, Jul 02 2014

Keywords

Comments

Palindrome is also a prime for n = 241, 443, 613, 641, 811, 20011, 20047, 20051, 20101, 20161, ... . Example: 613+316 = 929, which is prime. [Bruno Berselli, Jul 05 2014]
Subsequence of primes within A015976. - Michel Marcus, Jul 05 2014

Examples

			13 is in the sequence because 13+31 = 44 is a palindrome.
1103 is in the sequence because 1103+3011 = 4114 is a palindrome.
		

Crossrefs

Programs

  • Magma
    [p: p in PrimesUpTo(1200) | q eq Reverse(q) where q is Intseq(p+Seqint(Reverse(Intseq(p))))]; // Bruno Berselli, Jul 05 2014
  • Mathematica
    selQ[p_] := (id = IntegerDigits[p]; id2 = IntegerDigits[p + FromDigits[Reverse[id]]]; id2 == Reverse[id2]); Select[Array[Prime, 200], selQ] (* Jean-François Alcover, Jul 05 2014 *)
    Select[Prime[Range[200]],PalindromeQ[#+IntegerReverse[#]]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Nov 11 2020 *)

A309429 Least Luhn prime in base 2n: primes p such that p + reverse(p) in base 2n is also a prime.

Original entry on oeis.org

2, 37, 83, 137, 229, 317, 409, 557, 677, 829, 991, 1187, 1423, 1597, 1871, 2083, 2347, 2633, 2939, 3307, 3581, 3967, 4297, 4673, 5051, 5479, 5927, 6343, 6791, 7349, 7757, 8269, 8783, 9323, 9871, 10463, 11069, 11633, 12251, 12889, 13537, 14207, 14891, 15641
Offset: 1

Views

Author

Amiram Eldar, Aug 02 2019

Keywords

Comments

Luhn primes were named after Norman Luhn, who first noted the property of 229 on the website Prime Curios!.
There are no Luhn primes in odd base, and only one, 2, in base 2.

Examples

			a(2) = 37 since 37 = 211 in base 2*2 = 4, and 211+112 = 323 which equals 59 in base 10 and is prime.
		

Crossrefs

Cf. A061783.

Programs

  • Mathematica
    a[b_] := Module[{p=2}, While[!PrimeQ[p + FromDigits[Reverse @ IntegerDigits[p, b], b]], p = NextPrime[p]]; p]; Table[a[n], {n, 2, 88, 2}]
  • PARI
    a(n) = {my(p=2); while (!isprime(p+fromdigits(Vecrev(digits(p, 2*n)), 2*n)), p = nextprime(p+1)); p;} \\ Michel Marcus, Aug 03 2019

Formula

a(n) > 8*n^2 for n > 1.
Showing 1-10 of 12 results. Next