login
The OEIS is supported by the many generous donors to the OEIS Foundation.

 

Logo
Hints
(Greetings from The On-Line Encyclopedia of Integer Sequences!)
A048398 Primes with consecutive digits that differ exactly by 1. 22

%I #32 May 31 2017 22:44:51

%S 2,3,5,7,23,43,67,89,101,787,4567,12101,12323,12343,32321,32323,34543,

%T 54323,56543,56767,76543,78787,78989,210101,212123,234323,234343,

%U 432121,432323,432343,434323,454543,456767,654323,654343,678767,678989

%N Primes with consecutive digits that differ exactly by 1.

%C Or, primes in A033075. - _Zak Seidov_, Feb 01 2011

%D J.-M. De Koninck, Ces nombres qui nous fascinent, Entry 67, p. 23, Ellipses, Paris 2008.

%H Chai Wah Wu, <a href="/A048398/b048398.txt">Table of n, a(n) for n = 1..10000</a> (terms n = 1..1500 from Zak Seidov)

%t Select[Prime[Range[10000]], # < 10 || Union[Abs[Differences[IntegerDigits[#]]]] == {1} &]

%o (Haskell)

%o a048398 n = a048398_list !! (n-1)

%o a048398_list = filter ((== 1) . a010051') a033075_list

%o -- _Reinhard Zumkeller_, Feb 21 2012, Nov 04 2010

%o (Python 3.2 or higher)

%o from itertools import product, accumulate

%o from sympy import isprime

%o A048398_list = [2,3,5,7]

%o for l in range(1,17):

%o for d in [1,3,7,9]:

%o dlist = [d]*l

%o for elist in product([-1,1],repeat=l):

%o flist = [str(d+e) for d,e in zip(dlist,accumulate(elist)) if 0 <= d+e < 10]

%o if len(flist) == l and flist[-1] != '0':

%o n = 10*int(''.join(flist[::-1]))+d

%o if isprime(n):

%o A048398_list.append(n)

%o A048398_list = sorted(A048398_list) # _Chai Wah Wu_, May 31 2017

%Y Cf. A033075, A048399-A048405, A052016, A052017, A006055.

%Y Cf. A010051; intersection of A033075 and A000040.

%K nonn,base

%O 1,1

%A _Patrick De Geest_, Apr 15 1999

Lookup | Welcome | Wiki | Register | Music | Plot 2 | Demos | Index | Browse | More | WebCam
Contribute new seq. or comment | Format | Style Sheet | Transforms | Superseeker | Recents
The OEIS Community | Maintained by The OEIS Foundation Inc.

License Agreements, Terms of Use, Privacy Policy. .

Last modified April 25 03:15 EDT 2024. Contains 371964 sequences. (Running on oeis4.)