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.

A322443 Base-8 deletable primes (written in base 10).

This page as a plain text file.
%I A322443 #12 Jan 14 2022 01:59:26
%S A322443 2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,83,89,101,107,
%T A322443 109,131,137,139,151,157,163,167,179,181,191,197,199,211,223,229,233,
%U A322443 239,251,269,277,293,317,331,337,347,349,353,359,367,373,379,383,389,397,401,421,431,443,461,467,479,491
%N A322443 Base-8 deletable primes (written in base 10).
%C A322443 A prime p is a base-b deletable prime if when written in base b it has the property that removing some digit leaves either the empty string or another deletable prime.
%C A322443 Deleting a digit cannot leave any leading zeros in the new string. For example, deleting the 2 in 2003 to obtain 003 is not allowed.
%H A322443 Michael S. Branicky, <a href="/A322443/b322443.txt">Table of n, a(n) for n = 1..10000</a> (terms 1..566 from Robert Price)
%t A322443 b = 8; d = {};
%t A322443 p = Select[Range[2, 10000], PrimeQ[#] &];
%t A322443 For[i = 1, i <= Length[p], i++,
%t A322443 c = IntegerDigits[p[[i]], b];
%t A322443 If[Length[c] == 1, AppendTo[d, p[[i]]]; Continue[]];
%t A322443 For[j = 1, j <= Length[c], j++,
%t A322443 t = Delete[c, j];
%t A322443 If[t[[1]] == 0, Continue[]];
%t A322443 If[MemberQ[d, FromDigits[t, b]], AppendTo[d, p[[i]]]; Break[]]]];
%t A322443 d (* _Robert Price_, Dec 08 2018 *)
%o A322443 (Python)
%o A322443 from sympy import isprime
%o A322443 def ok(n):
%o A322443     if not isprime(n): return False
%o A322443     if n < 8: return True
%o A322443     o = oct(n)[2:]
%o A322443     oi = (o[:i]+o[i+1:] for i in range(len(o)))
%o A322443     return any(t[0] != '0' and ok(int(t, 8)) for t in oi)
%o A322443 print([k for k in range(492) if ok(k)]) # _Michael S. Branicky_, Jan 13 2022
%Y A322443 Cf. A080608, A080603, A096235-A096246.
%K A322443 nonn,base,easy
%O A322443 1,1
%A A322443 _Robert Price_, Dec 08 2018