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.

User: David Cobac

David Cobac's wiki page.

David Cobac has authored 3 sequences.

A329181 a(n) = n if n is 1 or prime; otherwise (1) let m = (concatenation of the two divisors in the middle of rows of A027750(n)), (2) if m is prime then a(n) = m, otherwise return to (1) with n=m.

Original entry on oeis.org

1, 2, 3, 211, 5, 23, 7, 223, 311, 773, 11, 21179, 13, 313, 1129, 3137, 17, 3449, 19, 59, 37, 211, 23, 223, 773, 3251, 313, 47, 29, 613, 31, 4373, 311, 21179, 1129, 3449, 37, 373, 313, 229, 41, 67, 43, 3137, 59, 223, 47, 4373, 131321, 33391, 317, 2333, 53
Offset: 1

Author

David Cobac, Nov 07 2019

Keywords

Comments

A term is a prime (or 1 for the first one) obtained by concatenating its two factors that are closest to its square root. Once they are concatenated (as strings), the process is iterated until concatenation gives a prime. Only composite numbers are processed.
At each iteration, we choose a couple (d, d') of divisors this way: n = d * d' and d = max({d >= 1 such that d|n and d<=sqrt(n)}), we replace n with the string concatenation of d and d' digits. The process ends with d = 1 (n is a prime).
This sequence is the balanced version of A316941.
Apparently it is only a conjecture that the process in the definition will alwats terminate. - N. J. A. Sloane, Feb 23 2020

Examples

			First three positive integers 1, 2, 3 do not change, so a(n)=n, for n <= 3.
4th term: sqrt(4)=2 and n=4=2*2 then n=22=2*11 and n=211 is a prime, so a(4)=211.
8th term: floor(sqrt(8))=2 and n=8=2*4 then n=24 but floor(sqrt(24))=4 so n=24=4*6 but floor(sqrt(46))=6 and 46's nearest factor to 6 is 2; thus 46=2*23 and 223 is a prime, so a(8)=223.
Thus a(8)=a(24)=a(46)=a(223)=223.
		

Crossrefs

Same process as A316941 with different factors.
Cf. A002808 (the composite numbers), A027750 (the divisors of n).

Programs

  • C
    /* See Cobac link. */
    
  • Mathematica
    Array[If[! CompositeQ@ #, #, NestWhile[Block[{k = Floor@ Sqrt@ #}, While[Mod[#, k] != 0, k--]; FromDigits@ Flatten[IntegerDigits /@ {k, #/k}]] &, #, !PrimeQ@ # &]] &, 53] (* Michael De Vlieger, Nov 15 2019 *)
  • PARI
    a(n) = {if (n==1, return (1)); if (isprime(n), return (n)); while (!isprime(n), my(d = divisors(n)); if (#d % 2 == 1, n = eval(concat(Str(d[#d\2+1]), Str(d[#d\2+1]))), n = eval(concat(Str(d[#d/2]), Str(d[#d/2+1]))));); n;} \\ Michel Marcus, Nov 15 2019

A306475 Smallest nonprime number <= 10^n (n>=1) with maximum distance from a prime.

Original entry on oeis.org

9, 93, 897, 9569, 31433, 492170, 4652430, 47326803, 436273150, 4302407536, 42652618575, 738832928197, 7177162612050, 90874329411895, 218209405436996, 1693182318746937, 80873624627235459, 804212830686678390
Offset: 1

Author

David Cobac, Feb 18 2019

Keywords

Comments

Each number is a mean of two consecutive primes.
Since, except 2, primes are odd numbers, this mean is an integer.

Examples

			For n=1: first prime numbers are 2, 3, 5, 7 and 11. Maximum difference between two consecutive primes is 4 between 7 and 11 thus a(1)=9.
For n=4: maximum difference between two primes less than 10^4 is 36, which occurs once: between 9551 and 9587. a(4)=(9551 + 9587)/2 = 9569.
		

Crossrefs

Extensions

More terms (using the b-file at A002386) from Jon E. Schoenfield, Feb 19 2019

A323416 a(n) = (n-1)! * (10^n - 1) / 9.

Original entry on oeis.org

1, 11, 222, 6666, 266664, 13333320, 799999920, 55999999440, 4479999995520, 403199999959680, 40319999999596800, 4435199999995564800, 532223999999946777600, 69189119999999308108800, 9686476799999990313523200, 1452971519999999854702848000, 232475443199999997675245568000, 39520825343999999960479174656000
Offset: 1

Author

David Cobac, Jan 13 2019

Keywords

Comments

Take an n-digit number with distinct digits, add all permutations of the digits, divide by the sum of the digits: the result is a(n).
Proof from David A. Corneth, Jan 14 2019: (Start)
Let m be an n-digit number (without leading 0, where n > 0). Then n! permutations of digits can be formed.
So each digit occurs n!/n = (n-1)! times in each position. Therefore the total sum is (10^n - 1) * (n - 1)! * s where s is the sum of digits of n. Dividing this product by s gives a(n) = (10^n - 1) * (n - 1)!. QED (End)

Examples

			Example for n = 3:
Take the number 569.
Sum the permutations of its digits: 569 + 596 + 659 + 695 + 956 + 965 = 4440.
Add all its digits: 5 + 6 + 9 = 20.
Divide: 4440 / 20 = 222.
General proof for n = 3:
Number: abc where a,b,c are distinct.
The sum of the permutations is 200*(a+b+c) + 20*(a+b+c) + 2*(a+b+c) = 222*(a+b+c), so a(3) = 222.
		

Crossrefs

Cf. A000142, A002275, A071267. Sum of digits A110728.

Programs

  • Mathematica
    Table[(n-1)! (10^n-1)/9,{n,20}] (* Harvey P. Dale, Mar 15 2024 *)
  • PARI
    a(n) = (10^n - 1) / 9 * (n-1)! \\ David A. Corneth, Jan 13 2019
  • Python
    f = lambda n:+(n==0) or n*f(n-1)
    def seq(n):
       if n==0: return
       l = []
       for i in range(1, n + 1):
           # following line with a string repeat
           # s = int('1'*i)
           s = 0
           for j in range(i):
               s += 10 ** j
           l += [s*f(i-1)]
       return l
    

Formula

Recurrence relation: a(n+1) = n! * 10^n + n * a(n).
Proof: Assume R_n is a string of n 1's (repunit),
a(n) = (n-1)! * R_n so a(n+1) = n! * R_{n+1} = n! * (10^n + R_n);
Thus a(n+1) = n! * 10^n + n! * R_n = n! * 10^n + n * (n-1)! * R_n;
Hence a(n+1) = n! * 10^n + n * a(n).

Extensions

Edited by N. J. A. Sloane, Jan 19 2019