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.

Original entry on oeis.org

6, 22, 66, 202, 222, 282, 434, 454, 474, 494, 555, 595, 838, 858, 969, 1001, 1551, 1771, 3333, 3553, 5335, 6006, 6226, 6886, 8778, 9889, 12921, 14541, 15051, 16261, 16761, 17171, 18681, 19491, 20202, 20602, 20802, 20902, 24142, 24242, 24542, 28282, 28482, 30003
Offset: 1

Views

Author

Marius A. Burtea, May 08 2022

Keywords

Comments

Intersection of A002113 and A157037.

Examples

			22 = A002113(12) and 22 = A157037(3), so 22 is a term.
66 = A002113(16) and 22 = A157037(8), so 66 is a term.
		

Crossrefs

Programs

  • Magma
    f:=func; pal:=func; [n:n in [2..30003]| pal(n) and IsPrime(Floor(f(n)))];
    
  • Maple
    filter:= proc(n) local t;
      isprime(n*add(t[2]/t[1], t=ifactors(n)[2]))
    end proc:
    digrev:= proc(n) local L,i;
      L:= convert(n,base,10);
      add(L[-i]*10^(i-1),i=1..nops(L))
    end proc:
    N:= 100: # for a(1) to a(N)
    Res:= 6: count:= 1:
    for d from 2 while count < N do
      if d::even then
        m:= d/2;
        for n from 10^(m-1) to 10^m-1 while count < N do
          v:=  n*10^m + digrev(n);
          if filter(v) then Res:= Res,v; count:= count+1  fi;
        od
      else
        m:= (d-1)/2;
        for n from 10^(m-1) to 10^m-1 while count < N do
          for y from 0 to 9 while count < N do
            v:= n*10^(m+1)+y*10^m+digrev(n);
            if filter(v) then Res:= Res,v; count:= count+1 fi;
        od od:
      fi
    od:
    Res; # Robert Israel, May 09 2023
  • Mathematica
    d[0] = d[1] = 0; d[n_] := n * Plus @@ ((Last[#]/First[#]) & /@ FactorInteger[n]); Select[Range[30003], PalindromeQ[#] && PrimeQ[d[#]] &] (* Amiram Eldar, May 09 2022 *)
  • PARI
    ad(n) = vecsum([n/f[1]*f[2]|f<-factor(n+!n)~]); \\ A003415
    isok(m) = my(d); isprime(ad(m)) && (d=digits(m)) && (d==Vecrev(d)); \\ Michel Marcus, May 09 2022
    
  • Python
    from itertools import chain, count, islice
    from sympy import isprime, factorint
    def A353703_gen(): # generator of terms
        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)))
    A353703_list = list(islice(A353703_gen(),20)) # Chai Wah Wu, Jun 23 2022