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.

Showing 1-5 of 5 results.

A276694 Where records occur in A209252.

Original entry on oeis.org

0, 11, 13, 101, 107, 177, 357, 1001, 1011, 10759, 11487, 42189, 113183, 344253, 1851759, 4787769, 15848679, 139367847, 240889077, 1167555543, 111738007953
Offset: 1

Views

Author

Paolo P. Lava, Sep 14 2016

Keywords

Comments

Except for the first term, all terms are coprime to 10. - Chai Wah Wu, Sep 19 2016

Crossrefs

Programs

  • Maple
    with(numtheory): P:= proc(q) local d,j,k,n,t,x; x:=4; print(0);
    for n from 1 to q do d:=ilog10(n)+1; t:=0;
    for k from 0 to d-1 do for j from 0 to 9 do
    if isprime(trunc(n/10^(k+1))*10^(k+1)+j*10^k+(n mod 10^k))
    then t:=t+1; fi; od; od;
    if isprime(n) then if t-d>x then x:=t-d; print(n); fi; else
    if t>x then x:=t; print(n); fi; fi; od; end: P(10^9);

Extensions

a(18)-a(19) from Chai Wah Wu, Sep 19 2016
a(20) from Michael S. Branicky, Apr 21 2025
a(21) from Michael S. Branicky, May 21 2025

A265733 Number of n-digit primes whose digits include at least n-1 digits "1".

Original entry on oeis.org

4, 8, 10, 9, 10, 13, 7, 16, 10, 11, 11, 13, 9, 11, 6, 7, 8, 16, 7, 11, 8, 9, 9, 10, 8, 12, 6, 13, 13, 21, 7, 12, 8, 7, 15, 16, 8, 9, 17, 9, 5, 22, 9, 15, 6, 12, 9, 20, 11, 13, 14, 11, 13, 12, 9, 15, 7, 4, 8, 12, 4, 11, 8, 15, 10, 17, 12, 12, 4, 9, 9, 14, 8, 14, 10, 7, 10, 14, 5, 14
Offset: 1

Views

Author

Keywords

Comments

Inspired by A241100 and its conjecture by Chai Wah Wu of Dec 10 2015.
The average value of a(n) is 10.6, median is 10, and mode is 11 for the first 1000 terms.
The first occurrence of k>0: 433, 361, 229, 1, 41, 15, 7, 2, 4, 3, 10, 26, 6, 51, 35, 8, 39, 180, 84, 48, 30, 42, 306, 138, 948, 642, ..., .
0 < a(n) < 27 for n < 1551.
It appears that a(n)/(9*n + 0^(n-1)) has its maximum at n = 2. - Altug Alkan, Dec 16 2015

Examples

			a(1) = 4 because {2, 3, 5, 7} are primes;
a(2) = 8 because {11, 13, 17, 19, 31, 41, 61, 71} are two digit primes with at least one digit being 1;
a(3) = 10 because {101, 113, 131, 151, 181, 191, 211, 311, 811, 911} are three digit primes with at least two digit being 1, etc.
		

Crossrefs

Programs

  • Maple
    A:= proc(n) local x,X,i,y;
      x:= (10^n-1)/9;
      y:= [x,seq(seq(x+10^i*y,y=1..8),i=0..n-1),seq(x - 10^i,i=0..n-2)];
      nops(select(isprime,y))
    end proc:
    map(A, [$1..100]); # Robert Israel, Dec 31 2015
  • Mathematica
    f1[n_] := Block[{cnt = k = 0, r = (10^n - 1)/9, s = {-1, 1, 2, 3, 4, 5, 6, 7, 8}}, If[ PrimeQ@ r, cnt++]; If[ PrimeQ[(10^(n - 1) - 1)/9], cnt--]; While[k < n, p = Select[r + 10^k*s, PrimeQ]; cnt += Length@ p; k++]; cnt]; Array[f1, 70]

Formula

Number of n-digit primes of the form 111...d...111, where the number of ones is at least n-1 and d is any other decimal digit.

A118118 Composite numbers that always remain composite when a single decimal digit of the number is changed.

Original entry on oeis.org

200, 204, 206, 208, 320, 322, 324, 325, 326, 328, 510, 512, 514, 515, 516, 518, 530, 532, 534, 535, 536, 538, 620, 622, 624, 625, 626, 628, 840, 842, 844, 845, 846, 848, 890, 892, 894, 895, 896, 898, 1070, 1072, 1074, 1075, 1076, 1078, 1130
Offset: 1

Views

Author

Adam Panagos (adam.panagos(AT)gmail.com), May 12 2006

Keywords

Comments

The term "prime-proof" for this property is found on projecteuler.net (cf. link). The nontrivial subsequence A143641 is that of odd elements not ending in 5 (i.e. not ending in 0,2,4,5,6 or 8); it starts 212159,595631,872897,... - M. F. Hasler, Sep 04 2008
Also indices n such that A209252(n) is zero. - Ray G. Opao, Aug 01 2020

Examples

			a(1) = 200 is in the sequence because changing any digit of 200 (for example 300, 220, or 209) is still composite. The integer 100 is not in the sequence because it can be changed to 107 which is prime.
		

Crossrefs

Programs

  • Magma
    IsA118118:=function(n); D:=Intseq(n); return forall{ : k in [1..#D], j in [0..9] | j eq D[k] or not IsPrime(Seqint(S)) where S:=Insert(D, k, k, [j]) }; end function; [ n: n in [1..1200] | IsA118118(n) ]; // Klaus Brockhaus, Feb 28 2011
    
  • Mathematica
    unprimeableQ[n_] := Block[{d = IntegerDigits@ n, t = {}}, Do[AppendTo[t, FromDigits@ ReplacePart[d, i -> #] & /@ DeleteCases[Range[0, 9], x_ /; x == d[[i]]]], {i, Length@ d}]; ! AnyTrue[Flatten@ t, PrimeQ]]; Select[Range@ 1200, unprimeableQ] (* Michael De Vlieger, Nov 09 2015, Version 10 *)
  • PARI
    /* return 1 if no digit can be changed to make it prime; if d=1, print a prime if n is not prime-proof */ isA118118(n,d=0)={ forstep( k=n\10*10+1, n\10*10+9,2, isprime(k) || next; d && print("prime:",k); return); if( n%2==0 || n%5==0, /* even or ending in 5: no other digit can make it prime, except for the case where the last digit is prime and the first digit is the only other nonzero one */ return( !isprime(n%10) || 9 < n % 10^( log(n+.5)\log(10) ) || (d && print("prime:",n%10)) )); o=10; until( n < o*=10, k=n-o*(n\o%10); for( i=0,9, isprime(k) && return(d && print("prime:",k)); k+=o));1} \\ M. F. Hasler, Sep 04 2008
    
  • Python
    from sympy import isprime
    def selfplusneighs(n):
        s = str(n); d = "0123456789"; L = len(s)
        yield from (int(s[:i]+c+s[i+1:]) for c in d for i in range(L))
    def ok(n): return all(not isprime(k) for k in selfplusneighs(n))
    print([k for k in range(1131) if ok(k)]) # Michael S. Branicky, Jun 19 2022

Extensions

Edited by Charles R Greathouse IV, Aug 05 2010

A346064 Number of primes that may be generated by changing any two digits of n simultaneously.

Original entry on oeis.org

21, 17, 20, 15, 21, 20, 21, 16, 21, 17, 23, 18, 22, 17, 23, 22, 23, 17, 23, 19, 23, 19, 22, 16, 23, 22, 23, 18, 23, 18, 22, 18, 21, 16, 22, 21, 22, 17, 22, 17, 23, 18, 22, 17, 23, 22, 23, 17, 23, 19, 23, 19, 22, 16, 23, 22, 23, 18, 23, 18, 22, 18, 21, 16, 22
Offset: 10

Views

Author

Franz Vrabec, Jul 03 2021

Keywords

Comments

Indices of low records are given by A345289. By heuristic considerations it is conjectured that a(n) > 0 for all n >= 10.

Examples

			Changing two digits of the number 17 simultaneously yields the primes 02,03,05,23,29,31,41,43,53,59,61,71,73,79,83,89, so a(17) = 16.
		

Crossrefs

Cf. A345289 (indices of record lows).
Cf. A209252 (changing one digit).

Programs

  • Maple
    A346064 := proc(n)
    local a, d, e, r, s, l, N, NN, nn, i;
    a := 0;
    N := convert(n, base, 10);
    l := nops(N);
    for d to l - 1 do
       for e from d + 1 to l do
          for r from 0 to 9 do
             for s from 0 to 9 do
            if r <> op(d, N) and s <> op(e, N) then
               NN := subsop(d = r, e = s, N);
               nn := add(op(i, NN)*10^(i - 1), i = 1 .. l);
               if isprime(nn) then a := a + 1; end if;
            end if;
            end do;
          end do;
       end do;
    end do;
    a;
    end proc:
  • Mathematica
    Table[Count[Flatten[FromDigits/@Tuples[ReplacePart[t=List/@IntegerDigits[n],{#->Complement[Range[0,9],t[[#]]],#2->Complement[Range[0,9],t[[#2]]]}]&@@#]&/@Subsets[Range@IntegerLength@n,{2}]],?PrimeQ],{n,10,100}] (* _Giorgos Kalogeropoulos, Jul 23 2021 *)
  • Python
    from sympy import isprime
    from itertools import combinations, product
    def change2(s):
        for i, j in combinations(range(len(s)), 2):
            for c, d in product("0123456789", repeat=2):
                if c != s[i] and d != s[j]:
                    yield s[:i] + c + s[i+1:j] + d + s[j+1:]
    def a(n): return sum(isprime(int(t)) for t in change2(str(n)))
    print([a(n) for n in range(10, 101)]) # Michael S. Branicky, Jul 23 2021

A383271 Number of primes (excluding n) that may be generated by replacing any binary digit of n with a digit from 0 to 1.

Original entry on oeis.org

0, 0, 1, 1, 1, 1, 2, 2, 0, 2, 2, 1, 1, 1, 0, 3, 1, 1, 2, 3, 0, 4, 1, 3, 0, 2, 0, 3, 1, 2, 1, 2, 0, 2, 1, 2, 1, 2, 0, 3, 1, 1, 1, 4, 0, 5, 1, 1, 0, 2, 0, 2, 1, 2, 0, 2, 0, 3, 1, 1, 1, 2, 0, 4, 0, 3, 2, 3, 0, 3, 1, 4, 1, 1, 0, 5, 0, 4, 1, 1, 0, 4, 1, 2, 0, 0, 0, 3, 1, 1
Offset: 0

Views

Author

Michael S. Branicky, Apr 21 2025

Keywords

Comments

Also, the number of prime neighbors of n in H(A070939(n), 2), where H(k, b) is the Hamming graph whose vertices are the sequences of length k over the alphabet {0,1,...,b-1} with adjacency being defined by having Hamming distance 1 (see A145667).
Prepending 1 is not allowed.

Examples

			a(3) = 1 since 3 = 11_2 can be changed to 10_2 = 2, which is prime.
a(5) = 1 since 5 = 101_2 can be changed to 001_2 = 1, 111_2 = 7 (prime), or 100_2 = 4.
a(6) = 2 since 6 = 110_2 can be changed to 010_2 = 2 (prime), 100_2 = 4, or 111_2 = 7 (prime).
a(7) = 2 since 7 = 111_2 can be changed to 011_2 = 3 (prime), 101_2 = 5 (prime), or 110_2 = 6.
		

Crossrefs

Base-2 analog of A209252.

Programs

  • Maple
    a:= n-> nops(select(isprime, [seq(Bits[Xor](2^i, n), i=0..ilog2(n))])):
    seq(a(n), n=0..100);  # Alois P. Heinz, Apr 23 2025
  • Mathematica
    A383271[n_] := Count[BitXor[n, 2^Range[0, BitLength[n] - 1]], _?PrimeQ];
    Array[A383271, 100, 0] (* Paolo Xausa, Apr 23 2025 *)
  • Python
    from gmpy2 import is_prime
    def a(n):
        if n == 0:
            return 0
        if n&1 == 0:
            return int(is_prime(n + 1)) + int(1<<(n.bit_length()-1)^n == 2)
        mask, c = 1, 0
        for i in range(n.bit_length()):
            if is_prime(mask^n):
                c += 1
            mask <<= 1
        return c
    print([a(n) for n in range(90)])
Showing 1-5 of 5 results.