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.

A033620 Numbers all of whose prime factors are palindromes.

This page as a plain text file.
%I A033620 #34 Apr 07 2021 00:23:45
%S A033620 1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,18,20,21,22,24,25,27,28,30,32,33,
%T A033620 35,36,40,42,44,45,48,49,50,54,55,56,60,63,64,66,70,72,75,77,80,81,84,
%U A033620 88,90,96,98,99,100,101,105,108,110,112,120,121,125,126,128,131
%N A033620 Numbers all of whose prime factors are palindromes.
%C A033620 Multiplicative closure of A002385; A051038 and A046368 are subsequences. - _Reinhard Zumkeller_, Apr 11 2011
%H A033620 Ivan Neretin, <a href="/A033620/b033620.txt">Table of n, a(n) for n = 1..10550</a>
%H A033620 <a href="/index/Pri#prime_factors">Index entries sequences related to prime factors</a>
%F A033620 Sum_{n>=1} 1/a(n) = Product_{p in A002385} p/(p-1) = 5.0949... - _Amiram Eldar_, Sep 27 2020
%e A033620 10 = 2 * 5 is a term since both 2 and 5 are palindromes.
%e A033620 110 = 2 * 5 * 11 is a term since 2, 5 and 11 are palindromes.
%p A033620 N:= 5: # to get all terms of up to N digits
%p A033620 digrev:= proc(t) local L; L:= convert(t,base,10);
%p A033620 add(L[-i-1]*10^i,i=0..nops(L)-1);
%p A033620 end proc:
%p A033620 PPrimes:= [2,3,5,7,11]:
%p A033620 for d from 3 to N by 2 do
%p A033620     m:= (d-1)/2;
%p A033620     PPrimes:= PPrimes, select(isprime,[seq(seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1)]);
%p A033620 od:
%p A033620 PPrimes:= map(op,[PPrimes]):
%p A033620 M:= 10^N:
%p A033620 B:= Vector(M);
%p A033620 B[1]:= 1:
%p A033620 for p in PPrimes do
%p A033620   for k from 1 to floor(log[p](M)) do
%p A033620      R:= [$1..floor(M/p^k)];
%p A033620      B[p^k*R] := B[p^k*R] + B[R]
%p A033620   od
%p A033620 od:
%p A033620 select(t -> B[t] > 0, [$1..M]); # _Robert Israel_, Jul 05 2015
%p A033620 # alternative
%p A033620 isA033620:= proc(n)
%p A033620     for d in numtheory[factorset](n) do
%p A033620         if not isA002113(op(1,d)) then
%p A033620             return false;
%p A033620         end if;
%p A033620     end do;
%p A033620     true ;
%p A033620 end proc:
%p A033620 for n from 1 to 300 do
%p A033620     if isA033620(n) then
%p A033620         printf("%d,",n) ;
%p A033620     end if;
%p A033620 end do: # _R. J. Mathar_, Sep 09 2015
%t A033620 palQ[n_]:=Reverse[x=IntegerDigits[n]]==x; Select[Range[131],And@@palQ/@First/@FactorInteger[#]&] (* _Jayanta Basu_, Jun 05 2013 *)
%o A033620 (Haskell)
%o A033620 a033620 n = a033620_list !! (n-1)
%o A033620 a033620_list = filter chi [1..] where
%o A033620    chi n = a136522 spf == 1 && (n' == 1 || chi n') where
%o A033620       n' = n `div` spf
%o A033620       spf = a020639 n  -- cf. A020639
%o A033620 -- _Reinhard Zumkeller_, Apr 11 2011
%o A033620 (PARI) ispal(n)=n=digits(n);for(i=1,#n\2,if(n[i]!=n[#n+1-i],return(0)));1
%o A033620 is(n)=if(n<13,n>0,vecmin(apply(ispal,factor(n)[,1]))) \\ _Charles R Greathouse IV_, Feb 06 2013
%o A033620 (Python)
%o A033620 from sympy import isprime, primefactors
%o A033620 def pal(n): s = str(n); return s == s[::-1]
%o A033620 def ok(n): return all(pal(f) for f in primefactors(n))
%o A033620 print(list(filter(ok, range(1, 132)))) # _Michael S. Branicky_, Apr 06 2021
%Y A033620 Cf. A002113, A002385, A046368, A051038.
%K A033620 nonn,base,easy
%O A033620 1,2
%A A033620 _N. J. A. Sloane_, May 17 1998