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.

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