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-3 of 3 results.

A269364 Difference between the number of occurrences of prime gaps not divisible by 3, versus number of prime gaps that are multiples of 3, up to n-th prime gap: a(n) = A269849(n) - A269850(n).

Original entry on oeis.org

1, 2, 3, 4, 5, 6, 7, 8, 7, 8, 7, 8, 9, 10, 9, 8, 9, 8, 9, 10, 9, 10, 9, 10, 11, 12, 13, 14, 15, 16, 17, 16, 17, 18, 19, 18, 17, 18, 17, 16, 17, 18, 19, 20, 21, 20, 19, 20, 21, 22, 21, 22, 23, 22, 21, 20, 21, 20, 21, 22, 23, 24, 25, 26, 27, 28, 27, 28, 29, 30, 29, 30, 29, 28, 29, 28, 29, 30, 31, 32, 33, 34, 35, 34
Offset: 1

Views

Author

Antti Karttunen, Mar 17 2016

Keywords

Comments

This is related to "Lemke Oliver-Soundararajan bias", term first used by Terence Tao March 14, 2016 in his blog.

Crossrefs

Programs

  • PARI
    a(n) = sum(k=1, n, ((prime(k+1) - prime(k)) % 3) != 0) - sum(k=1, n, ((prime(k+1) - prime(k)) % 3) == 0); \\ Michel Marcus, Mar 18 2016
  • Scheme
    (define (A269364 n) (- (A269849 n) (A269850 n)))
    

Formula

a(n) = A269849(n) - A269850(n).

A270311 Indices of primes ending with the same decimal digit as the previous or next prime.

Original entry on oeis.org

34, 35, 42, 43, 53, 54, 61, 62, 68, 69, 80, 81, 82, 83, 101, 102, 106, 107, 115, 116, 125, 126, 127, 128, 138, 139, 141, 142, 145, 146, 154, 155, 157, 158, 172, 173, 175, 176, 177, 178, 191, 192, 193, 194, 204, 205, 222, 223, 233, 234, 258, 259, 260, 266, 267, 269, 270, 279, 280, 289, 290, 306, 307
Offset: 1

Views

Author

Francois Alcover, Mar 15 2016

Keywords

Crossrefs

Cf. A270310.

Programs

  • Mathematica
    Select[Range@ 307, Function[k, Or[k == Mod[NextPrime@ Prime@ #, 10], k == Mod[NextPrime[Prime@ #, -1], 10]]]@ Mod[Prime@ #, 10] &] (* Michael De Vlieger, Mar 15 2016 *)
    PrimePi/@Select[Partition[Prime[Range[350]],3,1],Mod[#[[2]],10]==Mod[#[[1]],10]||Mod[#[[2]],10]==Mod[#[[3]],10]&][[;;,2]] (* Harvey P. Dale, Mar 07 2024 *)

Extensions

More terms from Michael De Vlieger, Mar 15 2016

A272043 a(n) is the shyest prime in base n.

Original entry on oeis.org

2, 3, 31, 13, 523, 31, 3833, 491, 5483, 523, 18149, 661, 44657, 3833, 18869, 7333, 165479, 5483, 153953, 20411, 129127, 18149, 538651, 7079, 932257, 44657, 417037, 52639, 2223773, 18869, 3124217, 175229, 1993763, 165479, 2794811, 50461, 8678963, 153953
Offset: 1

Views

Author

Andy Martin, Apr 18 2016

Keywords

Comments

Terminology: consider pairs of final digits of consecutive primes (a,b). Then of all pairs (3,1) is found last in the prime sequence, corresponding to (523, 541). This is termed the shyest pair, with 523 the shyest prime.
Consider final digit pairs (a,b) of consecutive primes.
There are three unique pairs: (2, 3) (3, 5) (5, 7)
For the remaining 16 pairs, record the first observed primes corresponding to the pair:
Initial prime -- Second prime (mod 10) ---
(mod 10) 1 3 7 9
1 181,191 11, 13 31, 37 401,409
3 523,541 283,293 13, 17 23, 29
7 7, 11 47, 53 337,347 17, 19
9 29, 31 19, 23 89, 97 139,149
523,541 is the largest pair, thus the last to occur in the sequence of primes. The first member of this pair is the shyest prime, base 10. (Note that if we consider two digit pairs (ab, cd) then 40191937, 40192037 is the shyest pair for base 10.)
For base 3 the table is:
Initial prime Second prime (mod 3)
(mod 3) 0 1 2
0 - - 3,5
1 - 31,37 7,11
2 2,3 5,7 23,29
and 31 is the shyest prime base 3.

Crossrefs

Programs

  • Mathematica
    a[n_] := Block[{g,p,m,q,k, e= First /@ Select[ Tally[ Mod[ Prime@ Range[n* 100], n]], #[[2]] > 50 &], A}, A = Association@ Table[{i,j} -> 0, {i,e}, {j,e}]; g = Length[e]^2; m=p=2; While[g > 0, q = NextPrime@p; k = Mod[{p, q}, n]; If[ Lookup[A, Key@k, 1] == 0, A[k] = 1; g--]; m=p; p=q]; m]; Array[a, 25] (* Giovanni Resta, Apr 19 2016 *)
  • Ruby
    require 'Prime'
    # Ruby Code
    # Generates Hash with first occurrences of all possible pairs (a,b)
    # of final digits for consecutive primes in specified base.
    def gen_hash(h, base)
      last_prime = 2
      iteration = last_found = 0
      Prime.each() do |prime|
        # This check could be improved & may be invalid for bases above 35.
        return if (iteration+=1) > 10000 && iteration > 2 * last_found
        next if prime == 2
        l =  last_prime.to_s(base)[-1]
        p =  prime.to_s(base)[-1]
        if h[[l,p]].nil?
          h[[l,p]] = [last_prime,prime]
          last_found = iteration
        end
        last_prime = prime
      end
    end
    puts "First Prime  Second Prime  Base  Difference  Different  Final Digits In"
    puts "                                                 Pairs    Base Notation"
    puts "          2             3     1           1          1              1 1"
    # For bases above 35 additional programming needed.
    2.upto(35){|base|
      gen_hash(h = Hash.new, base)
      p0 = h.values.sort.last[0]
      p1 = h.values.sort.last[1]
      printf("%11d  %12d  %4d  %10d %10d              %s %s\n",
      p0, p1, base, p1 - p0, h.length, p0.to_s(base)[-1], p1.to_s(base)[-1])
    }

Extensions

a(22)-a(38) from Giovanni Resta, Apr 19 2016
Showing 1-3 of 3 results.