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.

A231979 Numbers n such that for every digit d in n, 2*n + 6*d - 3 is prime.

This page as a plain text file.
%I A231979 #8 Nov 19 2013 12:32:24
%S A231979 1,2,4,5,7,8,10,13,17,19,22,29,32,34,37,43,44,50,52,55,65,67,70,77,83,
%T A231979 89,112,113,115,118,124,127,133,145,152,155,167,172,182,188,199,200,
%U A231979 215,229,274,277,295,302,308,322,362,379,400,418,433,488,494,499
%N A231979 Numbers n such that for every digit d in n, 2*n + 6*d - 3 is prime.
%C A231979 The coefficients 2,6,-3 yield more hits between 1 and 1000000 than 2,2,1 or 1,1,1.
%H A231979 T. D. Noe, <a href="/A231979/b231979.txt">Table of n, a(n) for n = 1..2000</a>
%e A231979 124 is in the sequence since
%e A231979   2*124+6*1-3=251 which is prime,
%e A231979   2*124+6*2-3=257 which is prime,
%e A231979   2*124+6*4-3=269 which is prime.
%e A231979 241 is NOT in the sequence since
%e A231979   2*241+6*2-3=491 which is prime,
%e A231979   2*241+6*4-3=503 which is prime,
%e A231979   but 2*241+6*1-3=485 which is not prime.
%t A231979 fQ[n_] := Module[{d = IntegerDigits[n]}, And @@ PrimeQ[2*n + 6*d - 3]]; Select[Range[1000], fQ] (* _T. D. Noe_, Nov 19 2013 *)
%o A231979 (Java)
%o A231979 public class Ndp {
%o A231979 // 2n+6d-3 is prime for all digits d in n
%o A231979 private static final int MAX = 1000000;
%o A231979 public static void main(String[] args) {
%o A231979   String sequence = "";
%o A231979   loop: for (int n = 1; sequence.length() < 250 && n < MAX; n++) {
%o A231979    for (int i = n; i > 0; i /= 10) {
%o A231979     int d = i % 10;
%o A231979     if (!isPrime(2 * n + 6 * d - 3)) {
%o A231979      continue loop;
%o A231979     }
%o A231979    }
%o A231979    sequence += n + ",";
%o A231979   }
%o A231979   System.out.println(sequence);
%o A231979 }
%o A231979 private static boolean isPrime(long n) {
%o A231979   for (long i = 2; i <= Math.sqrt(n); i++) {
%o A231979    if (n < 2 || n % i == 0) {
%o A231979     return false;
%o A231979    }
%o A231979   }
%o A231979   return true;
%o A231979 }
%o A231979 }
%K A231979 nonn,easy,base
%O A231979 1,2
%A A231979 _John R Phelan_, Nov 16 2013