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.

A353703 Palindromes (A002113) in A157037.

This page as a plain text file.
%I A353703 #19 May 09 2023 08:56:21
%S A353703 6,22,66,202,222,282,434,454,474,494,555,595,838,858,969,1001,1551,
%T A353703 1771,3333,3553,5335,6006,6226,6886,8778,9889,12921,14541,15051,16261,
%U A353703 16761,17171,18681,19491,20202,20602,20802,20902,24142,24242,24542,28282,28482,30003
%N A353703 Palindromes (A002113) in A157037.
%C A353703 Intersection of A002113 and A157037.
%H A353703 Robert Israel, <a href="/A353703/b353703.txt">Table of n, a(n) for n = 1..10000</a>
%e A353703 22 = A002113(12) and 22 = A157037(3), so 22 is a term.
%e A353703 66 = A002113(16) and 22 = A157037(8), so 66 is a term.
%p A353703 filter:= proc(n) local t;
%p A353703   isprime(n*add(t[2]/t[1], t=ifactors(n)[2]))
%p A353703 end proc:
%p A353703 digrev:= proc(n) local L,i;
%p A353703   L:= convert(n,base,10);
%p A353703   add(L[-i]*10^(i-1),i=1..nops(L))
%p A353703 end proc:
%p A353703 N:= 100: # for a(1) to a(N)
%p A353703 Res:= 6: count:= 1:
%p A353703 for d from 2 while count < N do
%p A353703   if d::even then
%p A353703     m:= d/2;
%p A353703     for n from 10^(m-1) to 10^m-1 while count < N do
%p A353703       v:=  n*10^m + digrev(n);
%p A353703       if filter(v) then Res:= Res,v; count:= count+1  fi;
%p A353703     od
%p A353703   else
%p A353703     m:= (d-1)/2;
%p A353703     for n from 10^(m-1) to 10^m-1 while count < N do
%p A353703       for y from 0 to 9 while count < N do
%p A353703         v:= n*10^(m+1)+y*10^m+digrev(n);
%p A353703         if filter(v) then Res:= Res,v; count:= count+1 fi;
%p A353703     od od:
%p A353703   fi
%p A353703 od:
%p A353703 Res; # _Robert Israel_, May 09 2023
%t A353703 d[0] = d[1] = 0; d[n_] := n * Plus @@ ((Last[#]/First[#]) & /@ FactorInteger[n]); Select[Range[30003], PalindromeQ[#] && PrimeQ[d[#]] &] (* _Amiram Eldar_, May 09 2022 *)
%o A353703 (Magma) f:=func<n |n le 1 select 0 else n*(&+[Factorisation(n)[i][2] / Factorisation(n)[i][1]: i in [1..#Factorisation(n)]])>; pal:=func<n|Intseq(n) eq Reverse(Intseq(n))>; [n:n in [2..30003]| pal(n) and IsPrime(Floor(f(n)))];
%o A353703 (PARI) ad(n) = vecsum([n/f[1]*f[2]|f<-factor(n+!n)~]); \\ A003415
%o A353703 isok(m) = my(d); isprime(ad(m)) && (d=digits(m)) && (d==Vecrev(d)); \\ _Michel Marcus_, May 09 2022
%o A353703 (Python)
%o A353703 from itertools import chain, count, islice
%o A353703 from sympy import isprime, factorint
%o A353703 def A353703_gen(): # generator of terms
%o A353703     return filter(lambda n:isprime(sum(n*e//p for p,e in factorint(n).items())), chain.from_iterable(chain((int((s:=str(d))+s[-2::-1]) for d in range(10**l,10**(l+1))), (int((s:=str(d))+s[::-1]) for d in range(10**l,10**(l+1)))) for l in count(0)))
%o A353703 A353703_list = list(islice(A353703_gen(),20)) # _Chai Wah Wu_, Jun 23 2022
%Y A353703 Cf. A002113, A003415, A157037.
%K A353703 nonn,base
%O A353703 1,1
%A A353703 _Marius A. Burtea_, May 08 2022