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.

A045707 Primes with first digit 1.

Original entry on oeis.org

11, 13, 17, 19, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087, 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151
Offset: 1

Views

Author

Keywords

Comments

Also primes with all divisors starting with digit 1. Complement of A206288 (nonprime numbers with all divisors starting with digit 1) with respect to A206287 (numbers with all divisors starting with digit 1). - Jaroslav Krizek, Mar 04 2012
Cohen and Katz show that the set of primes with first digit 1 has no natural density, but has supernatural/Dirichlet density log_{10} (2) ~= 0.3, the primes with first digit 2 have (supernatural) density log_{10} (3/2) ~= 0.176, ... and the primes with first digit 9 have density log_{10} (10/9) ~= 0.046. This would seem to explain the first digit phenomenon. Note that sum_{k = 1}^9 log_{10} (k+1)/k = 1. - Gary McGuire, Dec 22 2004
Lower density is 1/9, upper density is 5/9. The Dirichlet density, if it exists, is always between the lower and upper density (as it does and is in this case). - Charles R Greathouse IV, Sep 26 2022

Crossrefs

For primes with initial digit d (1 <= d <= 9) see A045707 (1, this sequence), A045708 (2), A045709 (3), A045710 (4), A045711 (5), A045712 (6), A045713 (7), A045714 (8), A045715 (9).
Column k=1 of A262369.

Programs

  • Magma
    [p: p in PrimesUpTo(10^4) | IsOne(Intseq(p)[#Intseq(p)])]; // Bruno Berselli, Jul 19 2014
    
  • Mathematica
    Select[Table[Prime[n], {n, 500}], First[IntegerDigits[#]] == 1 &]
    Flatten[Table[Prime[Range[PrimePi[10^n] + 1, PrimePi[2 * 10^n]]], {n, 3}]] (* Alonso del Arte, Jul 18 2014 *)
  • PARI
    list(lim)=my(v=[]); for(d=1,#digits(lim\=1)-1, v=concat(v,primes([10^d,min(lim,2*10^d-1)]))); v \\ Charles R Greathouse IV, Sep 26 2022
    
  • Python
    from itertools import chain, count, islice
    from sympy import primerange
    def A045707_gen(): # generator of terms
        return chain.from_iterable(primerange(m:=10**l,(m<<1)) for l in count(0))
    A045707_list = list(islice(A045707_gen(),40)) # Chai Wah Wu, Dec 07 2024
    
  • Python
    from sympy import primepi
    def A045707(n):
        def bisection(f,kmin=0,kmax=1):
            while f(kmax) > kmax: kmax <<= 1
            while kmax-kmin > 1:
                kmid = kmax+kmin>>1
                if f(kmid) <= kmid:
                    kmax = kmid
                else:
                    kmin = kmid
            return kmax
        def f(x): return n+x+primepi((m:=10**(l:=len(str(x))-1))-1)-primepi(min((m<<1)-1,x))+sum(primepi((m:=10**i)-1)-primepi((m<<1)-1) for i in range(l))
        return bisection(f,n,n) # Chai Wah Wu, Dec 07 2024

Extensions

More terms from Erich Friedman.
Cohen-Katz reference from Victor S. Miller, Dec 21 2004

A355592 Positions of records in A357299: integers m such that the number of divisors whose first digit equals the first digit of m sets a new record.

Original entry on oeis.org

1, 10, 100, 108, 120, 180, 1008, 1260, 1680, 10010, 10080, 15120, 100320, 100800, 110880, 166320, 196560, 1003200, 1004640, 1005480, 1028160, 1053360, 1081080, 1441440, 1884960, 10024560, 10090080, 10533600, 10810800, 12252240, 17297280, 100069200, 100124640, 100212840, 100245600
Offset: 1

Views

Author

Bernard Schott, Sep 24 2022

Keywords

Comments

Observation: all terms start with the digit 1.
The corresponding records are: 1, 2, 3, 4, 5, 6, 10, 11, 12, ...
For even terms k we have A000005(k) >= 2*A357299(k). For 3 <= n <= 101, A000005(k) >= 3*A357299(k). - David A. Corneth, Sep 26 2022

Examples

			1008 is a term because A357299(1008) = 10, the ten corresponding divisors are {1, 12, 14, 16, 18, 112, 126, 144, 168, 1008} and 10 is larger than any earlier value in A357299.
		

Crossrefs

Cf. A342833 (with last digit).

Programs

  • Mathematica
    f[n_] := IntegerDigits[n][[1]]; s[n_] := Module[{fn = f[n]}, DivisorSum[n, 1 &, f[#] == fn &]]; seq = {}; sm = 0; Do[If[(sn = s[n]) > sm, sm = sn; AppendTo[seq, n]], {n, 1, 200000}]; seq (* Amiram Eldar, Sep 24 2022 *)
  • PARI
    f(n) = my(fd=digits(n)[1]); sumdiv(n, d, digits(d)[1] == fd); \\ A357299
    lista(nn) = my(r=0, x, list=List()); for (n=1, nn, if ((x=f(n)) > r, listput(list, n); r = x);); Vec(list); \\ Michel Marcus, Sep 24 2022
    
  • PARI
    upto(n) = { r = -1; res = List(); forfactored(i = 1, n, if(numdiv(i[2]) >= r, d = divisors(i[2]); t = i[1]\10^logint(i[1], 10); c = sum(j = 1, #d, d[j]\10^logint(d[j], 10) == t); if(c > r, r = c; listput(res, i[1]); ) ) ); res } \\ David A. Corneth, Sep 24 2022
    
  • Python
    from sympy import divisors
    from itertools import count, islice
    def b(n): f = str(n)[0]; return sum(1 for d in divisors(n) if str(d)[0]==f)
    def agen(): # generator of terms
        record = -1
        for m in count(1):
            v = b(m)
            if v > record: yield m; record = v
    print(list(islice(agen(), 17))) # Michael S. Branicky, Sep 24 2022

Extensions

More terms from Michel Marcus, Sep 24 2022

A357300 a(n) is the smallest number m with exactly n divisors whose first digit equals the first digit of m.

Original entry on oeis.org

1, 10, 100, 108, 120, 180, 1040, 1020, 1170, 1008, 1260, 1680, 10010, 10530, 10200, 10260, 10560, 10800, 11340, 10920, 12600, 10080, 15840, 18480, 15120, 102060, 104400, 101640, 100320, 102600, 100980, 117600, 114660, 107100, 174240, 113400, 105840, 100800, 120120, 143640
Offset: 1

Views

Author

Bernard Schott, Sep 23 2022

Keywords

Comments

a(m) <= a(551) = 18681062400 for m < 555. All terms with values up to 2*10^10 start with 1. Do there exist a(n) starting with any other digit? - Charles R Greathouse IV, Sep 25 2022

Examples

			Of the twelve divisors of 108, four have their first digit equals to the first digit of 108: 1, 12, 18 and 108, and there is no such smaller number, hence a(4) = 108.
		

Crossrefs

Cf. A335491 (with last digit), A206287, A355592, A357299.
Similar, but with: A333456 (Niven numbers), A335038 (Zuckerman numbers).

Programs

  • Mathematica
    f[n_] := IntegerDigits[n][[1]]; s[n_] := Module[{fn = f[n]}, DivisorSum[n, 1 &, f[#] == fn &]]; seq[len_, nmax_] := Module[{v = Table[0, {len}], c = 0, n = 1, i}, While[c < len && n < nmax, i = s[n]; If[i <= len && v[[i]] == 0, c++; v[[i]] = n]; n++]; v]; seq[40, 10^6] (* Amiram Eldar, Sep 23 2022 *)
  • PARI
    f(n) = my(fd=digits(n)[1]); sumdiv(n, d, digits(d)[1] == fd); \\ A357299
    a(n) = my(k=1); while (f(k)!=n, k++); k; \\ Michel Marcus, Sep 23 2022
    
  • PARI
    v=vector(1000); v[1]=r=1; forfactored(n=2, 10^11, t=a(n[1],n[2],r); if(t>r && v[t]==0, v[t]=n[1]; print(t" "n[1]" = "n[2]); while(v[r],r++); r--)) \\ Charles R Greathouse IV, Sep 25 2022

Extensions

More terms from Michel Marcus, Sep 23 2022
Showing 1-3 of 3 results.