login
A384954
Primes such that moving the last digit to the front produces a triangular number.
1
3, 19, 2251, 3169, 6553, 7309, 7507, 13789, 20107, 21313, 38611, 39619, 43651, 44533, 48781, 52453, 54001, 54667, 65809, 70201, 75781, 76753, 78157, 79039, 87211, 173359, 188281, 196003, 247501, 366103, 370261, 390763, 435907, 482401, 498781, 540613, 542719
OFFSET
1,1
COMMENTS
Leading zeros are not allowed.
LINKS
EXAMPLE
2251 is a prime number and 1225 is a triangular number, so 2251 is a term.
MAPLE
q:= proc(n) n=3 or isprime(n) and issqr(1+8*parse(cat(irem(n, 10, 'm'), m))) end:
select(q, [$2..650000])[]; # Alois P. Heinz, Jun 14 2025
MATHEMATICA
Select[Prime[Range[45000]], OddQ[Sqrt[8*FromDigits[RotateRight[IntegerDigits[#]]]+1]]&] (* Harvey P. Dale, Aug 01 2025 *)
PROG
(Python)
from itertools import accumulate, count
from sympy import isprime
def rotate_left(n): return (s := str(n))[1:] + s[0]
def a384954_gen(lim): # Must be a power of 10. Terms are not generated in order.
for triangle in accumulate(count()):
if triangle >= lim: break
rotated = rotate_left(triangle)
if rotated[0] != '0' and isprime(p := int(rotated)):
yield p
print(sorted(a384954_gen(10**6))) # David Radcliffe, Jun 13 2025
CROSSREFS
KEYWORD
nonn,base
AUTHOR
David Radcliffe, Jun 13 2025
STATUS
approved