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.

A046328 Palindromes with exactly 2 prime factors (counted with multiplicity).

This page as a plain text file.
%I A046328 #48 Aug 15 2022 05:14:09
%S A046328 4,6,9,22,33,55,77,111,121,141,161,202,262,303,323,393,454,505,515,
%T A046328 535,545,565,626,707,717,737,767,818,838,878,898,939,949,959,979,989,
%U A046328 1111,1441,1661,1991,3113,3223,3443,3883,7117,7447,7997,9119,9229,9449,10001
%N A046328 Palindromes with exactly 2 prime factors (counted with multiplicity).
%H A046328 Giovanni Resta, <a href="/A046328/b046328.txt">Table of n, a(n) for n = 1..10000</a> (first 2000 terms from Zak Seidov, terms a(2001)-a(2816) from Michael De Vlieger)
%e A046328 111 is a palindrome and 111 = 3*37. 3 and 37 are primes.
%t A046328 fQ[n_] := Block[{id = IntegerDigits[n]}, Plus @@ Last /@ FactorInteger[n] == 2 && id == Reverse[id]]; Select[ Range[ 10000], fQ[ # ] &] (* _Robert G. Wilson v_, Jun 06 2005 *)
%t A046328 Select[Range[10002], Reverse[x = IntegerDigits[#]] == x && PrimeOmega[#] == 2 &] (* _Jayanta Basu_, Jun 23 2013 *)
%t A046328 Select[Range[11000],PalindromeQ[#]&&PrimeOmega[#]==2&] (* Requires Mathematica version 10 or later *) (* _Harvey P. Dale_, Apr 30 2018 *)
%o A046328 (PARI) ispal(n) = my(d=digits(n));d == Vecrev(d) \\ A002113
%o A046328 for(k=1,1e4,if(ispal(k)&&bigomega(k)==2, print1(k, ", "))) \\ _Alexandru Petrescu_, Jul 07 2022
%o A046328 (Python)
%o A046328 from sympy import factorint
%o A046328 from itertools import product
%o A046328 def ispal(n): s = str(n); return s == s[::-1]
%o A046328 def pals(d, base=10): # all d-digit palindromes
%o A046328     digits = "".join(str(i) for i in range(base))
%o A046328     for p in product(digits, repeat=d//2):
%o A046328         if d > 1 and p[0] == "0": continue
%o A046328         left = "".join(p); right = left[::-1]
%o A046328         for mid in [[""], digits][d%2]: yield int(left + mid + right)
%o A046328 def ok(pal): return sum(factorint(pal).values()) == 2
%o A046328 print(list(filter(ok, (p for d in range(1, 6) for p in pals(d) if ok(p))))) # _Michael S. Branicky_, Aug 14 2022
%Y A046328 Cf. A046315, A046408, A108505.
%Y A046328 Subsequence of A001358 and A046338.
%K A046328 nonn,base
%O A046328 1,1
%A A046328 _Patrick De Geest_, Jun 15 1998