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.

A354524 Primes p such that p+1 is the concatenation of a power of 3 and a power of 2.

This page as a plain text file.
%I A354524 #15 Aug 18 2022 11:45:16
%S A354524 11,13,17,31,37,97,131,163,271,277,331,811,1511,2437,2731,3511,7297,
%T A354524 9127,9511,18191,21871,27127,65617,72931,196831,196837,278191,332767,
%U A354524 729511,812047,1262143,1524287,1968331,2187511,5314411,5314417,5904931,6561127,7298191,15943237,47829697,53144131
%N A354524 Primes p such that p+1 is the concatenation of a power of 3 and a power of 2.
%H A354524 Robert Israel, <a href="/A354524/b354524.txt">Table of n, a(n) for n = 1..5803</a>
%e A354524 a(5) = 97 is a term because it is prime and 97 + 1 = 98 is the concatenation of 3^2 = 9 and 2^3 = 8.
%p A354524 M:= 10: # for terms with <= M digits
%p A354524 R:= NULL:
%p A354524 for i from 0 while 3^i < 10^(M-1) do
%p A354524   d:= 1+ilog10(3^i);
%p A354524   for j from 1 while 2^j < 10^(M-d) do
%p A354524     x:= dcat(3^i,2^j)-1;
%p A354524     if isprime(x) then R:= R,x fi
%p A354524 od od:
%p A354524 sort([R]);
%o A354524 (Python)
%o A354524 from sympy import isprime
%o A354524 from itertools import count, takewhile
%o A354524 def auptod(digits):
%o A354524     M = 10**digits
%o A354524     pows2 = list(takewhile(lambda x: x < M , (2**a for a in count(0))))
%o A354524     pows3 = list(takewhile(lambda x: x < M , (3**b for b in count(0))))
%o A354524     strs2, strs3 = list(map(str, pows2)), list(map(str, pows3))
%o A354524     concat = (int(s3+s2) for s3 in strs3 for s2 in strs2)
%o A354524     return sorted(set(t-1 for t in concat if t < M and isprime(t-1)))
%o A354524 print(auptod(10)) # _Michael S. Branicky_, Aug 16 2022
%Y A354524 Cf. A068801. Contains A068715.
%K A354524 nonn,base
%O A354524 1,1
%A A354524 _J. M. Bergot_ and _Robert Israel_, Aug 16 2022