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.

A109902 Happy primes of the form a*10^k + b with single-digit a and b, a > 0, k > 0.

This page as a plain text file.
%I A109902 #14 Aug 17 2017 22:02:44
%S A109902 13,19,23,31,79,97,103,109,409,709,907,1009,2003,3001,9001,9007,10009,
%T A109902 40009,70009,90001,90007,100003,200003,400009,900001,900007,1000003,
%U A109902 2000003,7000009,20000003,30000001,400000009,1000000009,4000000009,9000000001
%N A109902 Happy primes of the form a*10^k + b with single-digit a and b, a > 0, k > 0.
%C A109902 The subset of numbers of A035497 with the internal digits in the decimal representation all zero.
%C A109902 A number is in this sequence if and only if it is a prime of the form a00...00b, where (a,b) is one of (1,3), (1,9), (2,3), (3,1), (4,9), (7,9), (9,1), or (9,7). - _Nathaniel Johnston_, Apr 30 2011
%H A109902 Nathaniel Johnston, <a href="/A109902/b109902.txt">Table of n, a(n) for n = 1..90</a>
%p A109902 A003132 := proc(n) local digs,i ; digs := convert(n,base,10) ; add( (op(i,digs))^2,i=1..nops(digs)) ; end: isA035497 := proc(n) local nItr ; nItr := n ; if isprime(n) then while true do if nItr = 0 or nItr=4 or nItr = 16 or nItr = 20 or nItr = 37 or nItr = 42 or nItr =58 or nItr =89 or nItr = 145 then RETURN(false) ; elif nItr = 1 then RETURN(true) ; fi ; nItr := A003132(nItr) ; od ; else false ; fi ; end: isA109902 := proc(n) local digs,d ; if isprime(n) and n > 9 then digs := convert(n,base,10) ; for d from 2 to nops(digs)-1 do if op(d,digs) <> 0 then RETURN(false) ; fi ; od ; RETURN(isA035497(n)) ; else RETURN(false) ; fi ; end: for i from 1 to 20000 do p := ithprime(i) : if isA109902(p) then printf("%d,",p) ; fi ; od:
%p A109902 diglim:=20: dig:=[[1,3],[1,9],[2,3],[3,1],[4,9],[7,9],[9,1],[9,7]]: for k from 1 to diglim do for m from 1 to 8 do n:=dig[m][1]*10^k + dig[m][2]: if(isprime(n))then printf("%d, ",n): fi:od:od: # _Nathaniel Johnston_, Apr 30 2011
%t A109902 Select[Sort[Flatten[With[{ab={{1,3},{1,9},{2,3},{3,1},{4,9},{7,9},{9,1},{9,7}}},Table[FromDigits[Join[PadRight[{ab[[n,1]]},i,0],{ab[[n,2]]}]],{n,8},{i,9}]]]],PrimeQ] (* _Harvey P. Dale_, May 31 2013 *)
%Y A109902 Cf. A035497.
%K A109902 nonn,base
%O A109902 1,1
%A A109902 _Paul Muljadi_, Jun 22 2007
%E A109902 Edited by _R. J. Mathar_, Jul 13 2007
%E A109902 a(24) - a(35) from _Nathaniel Johnston_, Apr 30 2011