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-3 of 3 results.

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

Original entry on oeis.org

4, 6, 9, 22, 33, 55, 77, 111, 121, 141, 161, 202, 262, 303, 323, 393, 454, 505, 515, 535, 545, 565, 626, 707, 717, 737, 767, 818, 838, 878, 898, 939, 949, 959, 979, 989, 1111, 1441, 1661, 1991, 3113, 3223, 3443, 3883, 7117, 7447, 7997, 9119, 9229, 9449, 10001
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Examples

			111 is a palindrome and 111 = 3*37. 3 and 37 are primes.
		

Crossrefs

Subsequence of A001358 and A046338.

Programs

  • Mathematica
    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 *)
    Select[Range[10002], Reverse[x = IntegerDigits[#]] == x && PrimeOmega[#] == 2 &] (* Jayanta Basu, Jun 23 2013 *)
    Select[Range[11000],PalindromeQ[#]&&PrimeOmega[#]==2&] (* Requires Mathematica version 10 or later *) (* Harvey P. Dale, Apr 30 2018 *)
  • PARI
    ispal(n) = my(d=digits(n));d == Vecrev(d) \\ A002113
    for(k=1,1e4,if(ispal(k)&&bigomega(k)==2, print1(k, ", "))) \\ Alexandru Petrescu, Jul 07 2022
    
  • Python
    from sympy import factorint
    from itertools import product
    def ispal(n): s = str(n); return s == s[::-1]
    def pals(d, base=10): # all d-digit palindromes
        digits = "".join(str(i) for i in range(base))
        for p in product(digits, repeat=d//2):
            if d > 1 and p[0] == "0": continue
            left = "".join(p); right = left[::-1]
            for mid in [[""], digits][d%2]: yield int(left + mid + right)
    def ok(pal): return sum(factorint(pal).values()) == 2
    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

A046376 Palindromes with exactly 2 palindromic prime factors (counted with multiplicity), and no other prime factors.

Original entry on oeis.org

4, 6, 9, 22, 33, 55, 77, 121, 202, 262, 303, 393, 505, 626, 707, 939, 1111, 1441, 1661, 1991, 3443, 3883, 7997, 10201, 13231, 15251, 18281, 19291, 20602, 22622, 22822, 24842, 26662, 28682, 30903, 31613, 33933, 35653, 37673, 38683, 39993, 60206, 60406, 60806
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Comments

Equivalently, semiprime palindromes where both prime factors are palindromes. - Franklin T. Adams-Watters, Apr 11 2011
The sequence "trivially" includes products of palindromic primes p*q where
a) p = 2 or 3 and q has only digits < 4, as q = 11, 101, 131, 10301, 30103, ...
b) p <= 11 and q has only digits 0 and 1, as q = 101 and repunit primes A004022
c) p = 11 and q has only digits spaced out by zeros, as q = 101, 10301, 10501, 10601, 30103, 30203, 30403, 30703, 30803, ... - M. F. Hasler, Jan 04 2022

Examples

			The palindrome 35653 is a term since it has 2 factors, 101 and 353, both palindromic.
		

Crossrefs

Cf. A001358 (semiprimes), A002113 (palindromes), A002385 (palindromic primes).
Subsequence of A188650.

Programs

  • Mathematica
    Take[Select[Times@@@Tuples[Select[Prime[Range[5000]],PalindromeQ],2], PalindromeQ]// Union,50] (* Harvey P. Dale, Aug 25 2019 *)
  • PARI
    {first(N=50, p=1) = vector(N, i, until( bigomega( p=nxt_A002113(p))==2 && vecmin( apply( is_A002113, factor(p)[,1])),); p)} \\ M. F. Hasler, Jan 04 2022
    
  • Python
    from sympy import factorint
    from itertools import product
    def ispal(n): s = str(n); return s == s[::-1]
    def pals(d, base=10): # all d-digit palindromes
        digits = "".join(str(i) for i in range(base))
        for p in product(digits, repeat=d//2):
            if d > 1 and p[0] == "0": continue
            left = "".join(p); right = left[::-1]
            for mid in [[""], digits][d%2]: yield int(left + mid + right)
    def ok(pal):
        f = factorint(pal)
        return sum(f.values()) == 2 and all(ispal(p) for p in f)
    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

Formula

Intersection of A002113 and A046368; A188649(a(n)) = a(n). - Reinhard Zumkeller, Apr 11 2011

Extensions

Definition clarified by Franklin T. Adams-Watters, Apr 11 2011
More terms from Lars Blomberg, Nov 06 2015

A046392 Palindromes with exactly 2 distinct prime factors.

Original entry on oeis.org

6, 22, 33, 55, 77, 111, 141, 161, 202, 262, 303, 323, 393, 454, 505, 515, 535, 545, 565, 626, 707, 717, 737, 767, 818, 838, 878, 898, 939, 949, 959, 979, 989, 1111, 1441, 1661, 1991, 3113, 3223, 3443, 3883, 7117, 7447, 7997, 9119, 9229, 9449, 10001
Offset: 1

Views

Author

Patrick De Geest, Jun 15 1998

Keywords

Crossrefs

Intersection of A002113 and A006881.

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:
    f:= proc(n) local F;
      F:= ifactors(n)[2];
      if nops(F) = 2 and F[1,2]=1 and F[2,2]=1 then n fi
    end proc:
    N:=5: # for terms of up to N digits.
    Res:= 6:
    for d from 2 to N do
      if d::even then
        m:= d/2;
        Res:= Res, seq(f(n*10^m + revdigs(n)), n=10^(m-1)..10^m-1);
      else
        m:= (d-1)/2;
        Res:= Res, seq(seq(f(n*10^(m+1)+y*10^m+revdigs(n)), y=0..9), n=10^(m-1)..10^m-1);
      fi
    od:
    Res; # Robert Israel, Mar 24 2020
  • Mathematica
    pdpfQ[n_]:=Module[{idn=IntegerDigits[n]},idn==Reverse[idn] && PrimeNu[n] == PrimeOmega[n] == 2]; Select[Range[11000],pdpfQ] (* Harvey P. Dale, Dec 16 2012 *)
  • Python
    from sympy import factorint
    from itertools import product
    def pals(d, base=10): # all d-digit palindromes
        digits = "".join(str(i) for i in range(base))
        for p in product(digits, repeat=d//2):
            if d > 1 and p[0] == "0": continue
            left = "".join(p); right = left[::-1]
            for mid in [[""], digits][d%2]: yield int(left + mid + right)
    def ok(pal): f = factorint(pal); return len(f) == 2 and sum(f.values()) == 2
    print(list(filter(ok, (p for d in range(1, 5) for p in pals(d) if ok(p))))) # Michael S. Branicky, Jun 22 2021
Showing 1-3 of 3 results.