login
Palindromes with exactly 6 prime factors (counted with multiplicity).
5

%I #22 Jun 07 2024 08:05:19

%S 2772,2992,6776,8008,21112,21712,21912,23632,23832,25452,25752,25952,

%T 27472,28782,29392,40104,40304,40404,42024,42924,44044,44144,44744,

%U 44944,45954,46764,46864,48984,53235,54945,55755,59895,60606,61216

%N Palindromes with exactly 6 prime factors (counted with multiplicity).

%H Chai Wah Wu, <a href="/A046332/b046332.txt">Table of n, a(n) for n = 1..5000</a>

%F Intersection of A002113 and A046306. - _M. F. Hasler_, Jun 06 2024

%p N:= 6: # to get all terms of up to N digits

%p digrev:= proc(n) local L,Ln; L:= convert(n,base,10);Ln:= nops(L);

%p add(L[i]*10^(Ln-i),i=1..Ln);

%p end proc:

%p Res:= NULL:

%p for d from 2 to N do

%p if d::even then

%p m:= d/2;

%p Res:= Res, select(numtheory:-bigomega=6,

%p [seq](n*10^m + digrev(n), n=10^(m-1)..10^m-1));

%p else

%p m:= (d-1)/2;

%p Res:= Res, select(numtheory:-bigomega=6,

%p [seq](seq(n*10^(m+1)+y*10^m+digrev(n), y=0..9), n=10^(m-1)..10^m-1));

%p fi

%p od:

%p map(op,[Res]); # _Robert Israel_, Dec 23 2014

%o (Python)

%o from sympy import factorint

%o def palQgen10(l): # generator of palindromes in base 10 of length <= 2*l

%o if l > 0:

%o yield 0

%o for x in range(1,l+1):

%o for y in range(10**(x-1),10**x):

%o s = str(y)

%o yield int(s+s[-2::-1])

%o for y in range(10**(x-1),10**x):

%o s = str(y)

%o yield int(s+s[::-1])

%o A046332_list = [x for x in palQgen10(4) if sum(list(factorint(x).values())) == 6]

%o # _Chai Wah Wu_, Dec 21 2014

%o (PARI) A046332_upto(N, start=1, num_fact=6)={ my(L=List()); while(N >= start = nxt_A002113(start), bigomega(start)==num_fact && listput(L, start)); L} \\ _M. F. Hasler_, Jun 06 2024

%Y Cf. A002113 (palindromes), A046306 (bigomega = 6), A046319.

%Y Cf. A046396 (similar but terms must be squarefree), A373466 (similar, but only distinct prime divisors are counted).

%K nonn,base

%O 1,1

%A _Patrick De Geest_, Jun 15 1998