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.

A219248 Numbers such that the absolute difference of any two adjacent (decimal) digits is prime.

This page as a plain text file.
%I A219248 #25 Dec 23 2024 14:53:43
%S A219248 0,1,2,3,4,5,6,7,8,9,13,14,16,18,20,24,25,27,29,30,31,35,36,38,41,42,
%T A219248 46,47,49,50,52,53,57,58,61,63,64,68,69,70,72,74,75,79,81,83,85,86,92,
%U A219248 94,96,97,130,131,135,136,138,141,142,146,147,149,161,163,164
%N A219248 Numbers such that the absolute difference of any two adjacent (decimal) digits is prime.
%C A219248 Numbers which may (and do) occur in A219250 and A219249 (union {0}).
%C A219248 This is to A219250 and A219249 what A182175 is to A182177 and A182178.
%H A219248 Michael S. Branicky, <a href="/A219248/b219248.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..1000 from Harvey P. Dale)
%H A219248 E. Angelini, <a href="https://web.archive.org/web/*/http://list.seqfan.eu/oldermail/seqfan/2013-April/011035.html">Any digit-pair in S sums to a prime</a>, SeqFan list, Apr 11 2013
%t A219248 Select[Range[0,200],And@@PrimeQ[Abs[Differences[IntegerDigits[#]]]]&] (* _Harvey P. Dale_, Jun 06 2014 *)
%o A219248 (PARI) is_A219248(n)={!for(i=2,#n=digits(n),isprime(abs(n[i-1]-n[i]))||return)}
%o A219248 (Python)
%o A219248 def ok(n):
%o A219248     d = list(map(int, str(n)))
%o A219248     return all(abs(d[i]-d[i-1]) in {2,3,5,7} for i in range(1, len(d)))
%o A219248 print([k for k in range(164) if ok(k)]) # _Michael S. Branicky_, Sep 11 2024
%o A219248 (Python)
%o A219248 from itertools import count, islice
%o A219248 def A219248gen(seed=None): # generator of terms
%o A219248     nxt = {None:"123456789", "0":"2357", "1":"3468", "2":"04579",
%o A219248         "3":"01568", "4":"12679", "5":"02378", "6":"13489",
%o A219248         "7":"02459", "8":"1356", "9":"2467"}
%o A219248     def bgen(d, seed=None):
%o A219248         if d == 0: yield tuple(); return
%o A219248         yield from ((i,)+t for i in nxt[seed] for t in bgen(d-1, seed=i))
%o A219248     yield 0
%o A219248     for d in count(1):
%o A219248         yield from (int("".join(t)) for t in bgen(d, seed=seed))
%o A219248 print(list(islice(A219248gen(), 65))) # _Michael S. Branicky_, Sep 11 2024
%K A219248 nonn,base
%O A219248 1,3
%A A219248 _M. F. Hasler_, Apr 12 2013