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.

A007488 Primes whose reversal is a square.

Original entry on oeis.org

61, 163, 487, 691, 1297, 1861, 4201, 4441, 4483, 5209, 5227, 9049, 9631, 12391, 14437, 16141, 16987, 61483, 63211, 65707, 65899, 67057, 69481, 92767, 94273, 96979, 106303, 108061, 123031, 123373, 125329, 127291, 129643, 142771, 146857, 148249, 165901
Offset: 1

Views

Author

Keywords

Comments

Number of terms less than 10^k: 0, 0, 1, 4, 13, 26, 74, 213, 615, 1773, 5000, 14356, 41474, 120186, 352310, 1035235, ... - Muniru A Asiru, Jan 19 2018 and David A. Corneth, Jan 12 2019

Examples

			61 is in the sequence because 16 = 4^2.
163 is in the sequence because 361 = 19^2.
167 is not in the sequence because 761 is also prime, not a square.
		

References

  • N. J. A. Sloane and Simon Plouffe, The Encyclopedia of Integer Sequences, Academic Press, 1995 (includes this sequence).
  • James J. Tattersall, Elementary Number Theory in Nine Chapters, Cambridge University Press, 1999, page 113.
  • Charles W. Trigg, Primes with Reverses That Are Powers, J. Rec. Math., 17 (1985), 172-176.

Crossrefs

Cf. A059007, A068989. See A132388 for another version.
Primes whose reversal is a k-th power: A057699 (k=3), A058996 (k=4), A059000 (k=5), A059001 (k=6), A059002 (k=7), A059003 (k=8), A350363 (k=9), A059005 (k=10).

Programs

  • Magma
    [p: p in PrimesUpTo(150000)|IsSquare(Seqint(Reverse(Intseq(p))))];// Marius A. Burtea, Jan 12 2019
  • Maple
    revdigs:= proc(n)
    local L,nL,j;
    L:= convert(n,base,10);
    nL:= nops(L);
    add(L[i]*10^(nL-i),i=1..nL);
    end:
    map(proc(i) local r; r:= revdigs(i^2); if isprime(r) then r else NULL fi end proc, {$1..9999}); # Robert Israel, Aug 14 2014
  • Mathematica
    Select[Prime[Range[16000]], IntegerQ[Sqrt[ToExpression[StringReverse[ToString[#]]]]] &]
    Select[Prime[Range[16000]], IntegerQ[Sqrt[FromDigits[ Reverse[ IntegerDigits[ #]]]]] &] (* Harvey P. Dale, Jul 19 2011 *)
    Select[Prime@ Range[10^5], IntegerQ@ Sqrt@ IntegerReverse@ # &] (* Michael De Vlieger, Jan 20 2018 *)
  • PARI
    is(n)=isprime(n) && issquare(fromdigits(Vecrev(digits(n)))) \\ Charles R Greathouse IV, Feb 06 2017
    
  • PARI
    uptoQdigits(n) = {my(res=List(), i2); for(i=4, sqrtint(10^n), i2 = i^2; if(i%10!=0 && gcd(10, i2 \ (10^logint(i2, 10))) == 1, c=fromdigits(Vecrev(digits(i2))); if(isprime(c), listput(res,c) ) ) ); listsort(res); res } \\ David A. Corneth, Jan 12 2019
    
  • Python
    from gmpy2 import is_square
    from sympy import prime
    A007488 = [prime(n) for n in range(1,10**6) if is_square(int(str(prime(n))[::-1]))] # Chai Wah Wu, Aug 14 2014
    

A059695 Primes p such that p^2 reversed is also prime.

Original entry on oeis.org

19, 37, 41, 89, 97, 139, 193, 271, 277, 281, 313, 331, 353, 373, 383, 397, 401, 421, 439, 443, 557, 587, 853, 971, 991, 1039, 1063, 1109, 1129, 1153, 1171, 1181, 1249, 1277, 1289, 1297, 1303, 1307, 1319, 1399, 1409, 1753, 1789, 1823, 1847, 1973
Offset: 1

Views

Author

Robert G. Wilson v, Feb 06 2001

Keywords

Crossrefs

Cf. A059007.
Primes p such that p^k reversed is also prime: A059696 (k=3), ..., A059705 (k=12).

Programs

  • Magma
    [p: p in PrimesUpTo(2000) | IsPrime(Seqint(Reverse(Intseq(p^2))))]; // Vincenzo Librandi, Apr 12 2013
    
  • Mathematica
    Select[ Range[ 2500 ], PrimeQ[ # ] && PrimeQ[ ToExpression[ StringReverse[ ToString[ #^2 ] ] ] ] & ]
  • PARI
    select(p->isprime(fromdigits(Vecrev(digits(p^2)))), primes(1000)) \\ Mohammed Yaseen, Dec 31 2021
  • Python
    from sympy import isprime, primerange
    def ok(p): return isprime(int(str(p**2)[::-1]))
    print([p for p in primerange(1, 2000) if ok(p)]) # Michael S. Branicky, Dec 27 2021
    

A068989 Squares which when reversed are primes (ignore leading zeros).

Original entry on oeis.org

16, 196, 361, 784, 1024, 1369, 1444, 1600, 1681, 3844, 7225, 7921, 9025, 9409, 11236, 14161, 18496, 19321, 19600, 36100, 37249, 38416, 70756, 73441, 75076, 76729, 78400, 78961, 97969, 99856, 102400, 105625, 107584, 109561, 111556, 112225
Offset: 1

Views

Author

Joseph L. Pe, Mar 12 2002

Keywords

Examples

			40^2 = 1600. Reversing the digits we get 0061, which is the prime 61 padded with leading zeroes. Hence 1600 is in the sequence.
41^2 = 1681. Reversing the digits we get 1861, which is a prime. Hence 1681 is in the sequence.
42^2 = 1764. Reversing the digits we get 4671 = 3^3 * 173. So 1764 is not in the sequence.
		

Crossrefs

Cf. primes whose reversal is a square, A007488; numbers n such that n^2 reversed is a prime, A059007.

Programs

  • Mathematica
    Do[s = i^2; If[PrimeQ[FromDigits[Reverse[IntegerDigits[s]]]], Print[s]], {i, 1, 10^2}] (* Pe *)
    Select[Range[100]^2, PrimeQ[FromDigits[Reverse[IntegerDigits[#]]]] &] (* Alonso del Arte, Jan 07 2018 *)
  • PARI
    isok(n) = issquare(n) && isprime(fromdigits(Vecrev(digits(n)))); \\ Michel Marcus, Jan 07 2018

Extensions

More terms from Zak Seidov, Jan 26 2005
Edited by N. J. A. Sloane, Dec 23 2007

A231756 Numbers n such that reversal (n^2) plus 1 is prime.

Original entry on oeis.org

1, 2, 5, 8, 9, 10, 15, 16, 17, 20, 26, 29, 46, 50, 51, 52, 79, 80, 81, 83, 90, 92, 94, 100, 142, 144, 149, 150, 159, 160, 161, 162, 167, 168, 170, 171, 172, 173, 200, 246, 247, 251, 254, 255, 258, 259, 260, 262, 264, 283, 284, 287, 289, 290, 297, 299, 449, 454
Offset: 1

Views

Author

K. D. Bajpai, Nov 21 2013

Keywords

Comments

If n is a multiple of 10, after reversal leading zeros are discarded before adding 1.

Examples

			a(3)= 5: 5^2= 25: reversing the digits gives 52: 52+1= 53 which is prime.
a(7)= 15: 15^2= 225: reversing the digits gives 522: 522+1= 523 which is prime.
		

Crossrefs

Cf. A005574 (numbers n: n^2 + 1 is prime).
Cf. A059007 (numbers n: n^2 reversed is a prime).

Programs

  • Maple
    with(StringTools):KD:= proc() local a; a:= parse(Reverse(convert((n^2), string)))+1;if isprime(a) then RETURN (n): fi;end: seq(KD(), n=1..1000);
  • Mathematica
    Select[Range[500], PrimeQ[ToExpression[StringReverse[ToString[#^2]]] + 1] &]
    Select[Range[500],PrimeQ[IntegerReverse[#^2]+1]&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Dec 04 2018 *)

A306301 Numbers k such that k^2 reversed is a prime and k^2+(k^2 reversed) is a prime.

Original entry on oeis.org

14, 136, 190, 266, 280, 1036, 1060, 1306, 1406, 1898, 1934, 2660, 2686, 2746, 2776, 3112, 10040, 10250, 10546, 10550, 10630, 10880, 11090, 11156, 11204, 11276, 11354, 11386, 11474, 11740, 11804, 11914, 12064, 12136, 12194, 12250, 12410, 12524, 12626, 12710, 12770, 12794, 12916, 13060
Offset: 1

Views

Author

Robert Price, Mar 31 2019

Keywords

Comments

All terms are even and not divisible by 3. - Robert Israel, Apr 09 2019

Examples

			14 is a term because 691 (the reverse of 14^2=196) and 196+691=887 are two prime numbers.
		

Crossrefs

Programs

  • Maple
    revdigs:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    filter:= proc(k) local v; v:= revdigs(k^2); isprime(v) and isprime(v+k^2) end proc:
    select(filter, [seq(seq(6*i+j,j=[2,4]),i=0..10000)]); # Robert Israel, Apr 09 2019
  • Mathematica
    Select[Range[50000], PrimeQ[IntegerReverse[#^2]] && PrimeQ[#^2 + IntegerReverse[#^2]] &]
  • PARI
    isok(k) = my(kk=fromdigits(Vecrev(digits(k^2)))); isprime(kk) && isprime(k^2+kk); \\ Michel Marcus, Apr 01 2019

A307046 Numbers k such that k^2 reversed is a prime and k^2 + (k^2 reversed) is a semiprime.

Original entry on oeis.org

4, 28, 40, 62, 106, 140, 193, 196, 274, 316, 334, 400, 410, 554, 556, 620, 862, 866, 874, 884, 962, 1004, 1025, 1066, 1154, 1174, 1190, 1205, 1256, 1274, 1294, 1360, 1390, 1394, 1396, 1400, 1744, 1784, 1816, 1844, 1891, 1900, 1927, 1960, 1981, 1988, 2672, 2696, 2710, 2722, 2740, 2786, 2800, 3016, 3026
Offset: 1

Views

Author

Robert Price, Mar 31 2019

Keywords

Examples

			4^2=16, reversed is 61. 16+61=77 which is semiprime (7*11), so 4 is in this sequence.
		

Crossrefs

Programs

  • Maple
    revdigs:= proc(n) local L,i;
    L:= convert(n,base,10);
    add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    filter:= proc(n) local a,b;
    a:= n^2;
    b:= revdigs(a);
    isprime(b) and numtheory:-bigomega(a+b)=2
    end proc:
    select(filter, [$1..10000]); # Robert Israel, Mar 31 2019
  • Mathematica
    Select[Range[50000],
    PrimeQ[IntegerReverse[#^2]] &&
       PrimeOmega[#^2 + IntegerReverse[#^2]] == 2 &]

A320909 Numbers k such that k^2 and k^3, when reversed, are prime.

Original entry on oeis.org

89, 271, 325, 328, 890, 1025, 1055, 1081, 1129, 1169, 1241, 2657, 2710, 3112, 3121, 3149, 3244, 3250, 3263, 3280, 3335, 3346, 3403, 4193, 4222, 4231, 4289, 4291, 5531, 5584, 5653, 5678, 5716, 5791, 5795, 5836, 5837, 8882, 8900, 8926, 8942, 9664, 9794, 9875
Offset: 1

Views

Author

Jesse Endo Jenks, Oct 23 2018

Keywords

Examples

			89 is a term since 89^2 = 7921 and 1297 is prime, and 89^3 = 704969 and 969407 is prime.
		

Crossrefs

Intersection of A059007 and A059008.

Programs

  • Mathematica
    Select[Range[10^4], AllTrue[IntegerReverse@ {#^2, #^3}, PrimeQ] &] (* Michael De Vlieger, Oct 23 2018 *)
  • PARI
    isok(n) = isprime(fromdigits(Vecrev(digits(n^2)))) && isprime(fromdigits(Vecrev(digits(n^3)))); \\ Michel Marcus, Oct 23 2018
    
  • Python
    from sympy import isprime
    A320909_list = [n for n in range(1,10**6) if isprime(int(str(n**2)[::-1])) and isprime(int(str(n**3)[::-1]))] # Chai Wah Wu, Jan 24 2019
Showing 1-7 of 7 results.