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: Simon Strandgaard

Simon Strandgaard's wiki page.

Simon Strandgaard has authored 33 sequences. Here are the ten most recent ones:

A350493 a(n) = floor(sqrt(prime(n)))^2 mod n.

Original entry on oeis.org

0, 1, 1, 0, 4, 3, 2, 0, 7, 5, 3, 0, 10, 8, 6, 1, 15, 13, 7, 4, 1, 20, 12, 9, 6, 22, 19, 16, 13, 10, 28, 25, 22, 19, 4, 0, 33, 30, 27, 9, 5, 1, 40, 37, 16, 12, 8, 4, 29, 25, 21, 17, 13, 9, 36, 32, 28, 24, 20, 16, 12, 41, 37, 33, 29, 25, 56, 52, 48, 44, 40, 36
Offset: 1

Author

Simon Strandgaard, Jan 01 2022

Keywords

Examples

			a(4) = A065730(4) mod 4 =  4 mod 4 = 0;
a(5) = A065730(5) mod 5 =  9 mod 5 = 4;
a(6) = A065730(6) mod 6 =  9 mod 6 = 3;
a(7) = A065730(7) mod 7 = 16 mod 7 = 2.
		

Crossrefs

Programs

  • Mathematica
    Table[PowerMod[Floor[Sqrt[Prime[n]]],2,n],{n,72}] (* Stefano Spezia, Jan 02 2022 *)
  • PARI
    a(n) = (sqrtint(prime(n))^2) % n;
    vector(20,n,a(n))
    
  • Python
    from sympy import prime, integer_nthroot
    def a(n): return (integer_nthroot(prime(n), 2)[0]**2)%n
    print([a(n) for n in range(1, 73)]) # Michael S. Branicky, Jan 02 2022
  • Ruby
    require 'prime'
    values = []
    Prime.first(20).each_with_index do |prime, i|
        values << ((Integer.sqrt(prime) ** 2) % (i + 1))
    end
    p values
    

Formula

a(n) = A065730(n) mod n.

A349487 a(n) = A132739((n-5)*(n+5)).

Original entry on oeis.org

11, 24, 39, 56, 3, 96, 119, 144, 171, 8, 231, 264, 299, 336, 3, 416, 459, 504, 551, 24, 651, 704, 759, 816, 7, 936, 999, 1064, 1131, 48, 1271, 1344, 1419, 1496, 63, 1656, 1739, 1824, 1911, 16, 2091, 2184, 2279, 2376, 99, 2576, 2679, 2784, 2891, 24, 3111
Offset: 6

Author

Simon Strandgaard, Nov 19 2021

Keywords

Comments

Shares 614 initial terms with A061043. First difference is A061043(620)=615 vs. a(620)=123.

Examples

			a(9)  = A132739(( 9-5)*( 9+5)) = A132739(56) = 56,
a(10) = A132739((10-5)*(10+5)) = A132739(75) = 3,
a(11) = A132739((11-5)*(11+5)) = A132739(96) = 96.
		

Crossrefs

Programs

  • Mathematica
    Table[Last@Select[Divisors[(n - 5)*(n + 5)], Mod[#, 5] != 0 &], {n, 6,
       56}] (* Giorgos Kalogeropoulos, Nov 19 2021 *)
    Table[(n - 5)*(n + 5)/5^IntegerExponent[(n - 5)*(n + 5), 5], {n, 6, 56}] (* Amiram Eldar, Nov 22 2021 *)
  • PARI
    A132739(n)=n/5^valuation(n, 5);
    a(n) = A132739((n-5)*(n+5));
    [a(n)|n<-[6..25]]
    
  • Python
    def A349487(n):
        a, b = divmod(n*n-25, 5)
        while b == 0:
            a, b = divmod(a,5)
        return 5*a+b # Chai Wah Wu, Dec 05 2021
  • Ruby
    p (6..25).map { |n| x = (n-5)*(n+5); x /= 5 while (x % 5) == 0; x }
    

Formula

a(n) = A132739(A098603(n-5)).

A348762 a(n) = A000265((n-8)*(n+8)).

Original entry on oeis.org

17, 9, 57, 5, 105, 33, 161, 3, 225, 65, 297, 21, 377, 105, 465, 1, 561, 153, 665, 45, 777, 209, 897, 15, 1025, 273, 1161, 77, 1305, 345, 1457, 3, 1617, 425, 1785, 117, 1961, 513, 2145, 35, 2337, 609, 2537, 165, 2745, 713, 2961, 3, 3185, 825, 3417, 221, 3657
Offset: 9

Author

Simon Strandgaard, Oct 31 2021

Keywords

Comments

Shares 495 initial terms with A061049. First difference is A061049(504)=62 vs. a(504)=31.

Examples

			a( 9) = A000265(( 9-8)*( 9+8)) = A000265( 17) = 17,
a(10) = A000265((10-8)*(10+8)) = A000265( 36) = 9,
a(11) = A000265((11-8)*(11+8)) = A000265( 57) = 57,
a(12) = A000265((12-8)*(12+8)) = A000265( 80) = 5,
a(13) = A000265((13-8)*(13+8)) = A000265(105) = 105.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := (n - 8)*(n + 8)/2^IntegerExponent[(n - 8)*(n + 8), 2]; Array[a, 53, 9] (* Amiram Eldar, Nov 22 2021 *)
  • PARI
    A000265(n) = n >> valuation(n, 2);
    a(n) = A000265((n-8)*(n+8));
    [a(n)|n<-[9..27]]
    
  • Python
    def A348762(n):
        a, b = divmod(n*n-64, 2)
        while b == 0:
            a, b = divmod(a,2)
        return 2*a+b # Chai Wah Wu, Dec 05 2021
  • Ruby
    p (9..27).map { |n| x = (n-8)*(n+8); x /= 2 while x.even?; x }
    

Formula

a(n) = A000265(A098849(n-8)).

A348287 Arrange nonzero digits of n in increasing order then append the zeros.

Original entry on oeis.org

0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 12, 22, 23, 24, 25, 26, 27, 28, 29, 30, 13, 23, 33, 34, 35, 36, 37, 38, 39, 40, 14, 24, 34, 44, 45, 46, 47, 48, 49, 50, 15, 25, 35, 45, 55, 56, 57, 58, 59, 60, 16, 26, 36, 46, 56, 66
Offset: 0

Author

Simon Strandgaard, Oct 10 2021

Keywords

Comments

Shares 101 initial terms with A328447. First difference is A328447(101)=101 vs A348287(101)=110.

Examples

			a(1010) = 1100,
a(1234567890) = 1234567890,
a(9876543210) = 1234567890.
		

Crossrefs

Programs

  • Mathematica
    a[n_] := 10^DigitCount[n, 10, 0] * FromDigits[Sort[IntegerDigits[n]]]; Array[a, 100, 0] (* Amiram Eldar, Oct 10 2021 *)
  • PARI
    a(n) = fromdigits(vecsort(digits(n), x->if(x,x,10)));
    
  • Python
    def a(n): s = str(n); return int("".join(sorted(s)))*10**s.count('0')
    print([a(n) for n in range(68)]) # Michael S. Branicky, Oct 10 2021
  • Ruby
    p Array.new(40) { |n|
      n.to_s.gsub('0','a').split(//).sort.join.gsub('a','0').to_i
    }
    

A347342 a(n) = prime(n) mod floor(prime(n) / n).

Original entry on oeis.org

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

Author

Simon Strandgaard, Aug 27 2021

Keywords

Examples

			a(1) =  2 mod floor( 2 / 1) =  2 mod 2 = 0,
a(2) =  3 mod floor( 3 / 2) =  3 mod 1 = 0,
a(3) =  5 mod floor( 5 / 3) =  5 mod 1 = 0,
a(4) =  7 mod floor( 7 / 4) =  7 mod 1 = 0,
a(5) = 11 mod floor(11 / 5) = 11 mod 2 = 1.
		

Crossrefs

Programs

  • Mathematica
    A347342[n_] := Mod[Prime[n] , Floor[Prime[n]/n]]; Table[A347342[n], {n, 1, 86}] (* Robert P. P. McKone, Aug 27 2021 *)
  • PARI
    a(n) = prime(n) % (prime(n) \ n);
    
  • Ruby
    require 'prime'
    values = []
    Prime.first(30).each_with_index do |prime,i|
        values << prime % (prime/(i+1))
    end
    p values

Formula

a(n) = A000040(n) mod A038605(n).

A347112 a(n) = concat(prime(n+1),n) mod prime(n).

Original entry on oeis.org

1, 1, 3, 2, 3, 7, 10, 10, 0, 7, 22, 5, 8, 27, 4, 33, 40, 8, 17, 7, 37, 27, 42, 23, 37, 24, 15, 14, 102, 74, 50, 108, 96, 61, 86, 32, 9, 112, 138, 121, 62, 137, 52, 58, 48, 52, 192, 2, 22, 221, 185, 13, 89, 152, 141, 130, 257, 116, 182, 260, 212, 290, 156, 264
Offset: 1

Author

Simon Strandgaard, Aug 18 2021

Keywords

Examples

			a(1) = concat( 3,1) mod  2 = 1,
a(2) = concat( 5,2) mod  3 = 1,
a(3) = concat( 7,3) mod  5 = 3,
a(4) = concat(11,4) mod  7 = 2,
a(5) = concat(13,5) mod 11 = 3.
		

Crossrefs

Programs

  • Mathematica
    Array[Mod[#3*10^(1 + Floor[Log10[#1]]) + #1, #2] & @@ {#, Prime[#], Prime[# + 1]} &, 64] (* Michael De Vlieger, Aug 18 2021 *)
  • PARI
    a(n) = eval(Str(prime(n+1),n)) % prime(n);
    
  • Python
    from sympy import prime
    def a(n): return int(str(prime(n+1)) + str(n))%prime(n)
    print([a(n) for n in range(1, 65)]) # Michael S. Branicky, Aug 18 2021
  • Ruby
    require 'prime'
    values = []
    primes = Prime.first(50)
    primes.each_index do |n|
      next if n < 1
      values << (primes[n].to_s + n.to_s).to_i % primes[n-1]
    end
    p values
    

A345727 a(n) = (prime(n)+1) * prime(n+1).

Original entry on oeis.org

9, 20, 42, 88, 156, 238, 342, 460, 696, 930, 1184, 1558, 1806, 2068, 2544, 3186, 3660, 4154, 4828, 5256, 5846, 6640, 7476, 8730, 9898, 10506, 11128, 11772, 12430, 14478, 16768, 18084, 19182, 20860, 22650, 23864, 25754, 27388, 29064, 31146, 32580, 34762
Offset: 1

Author

Simon Strandgaard, Jul 20 2021

Keywords

Examples

			a(1) = (prime(1)+1) * prime(2) = 3 *  3 =  9,
a(2) = (prime(2)+1) * prime(3) = 4 *  5 = 20,
a(3) = (prime(3)+1) * prime(4) = 6 *  7 = 42,
a(4) = (prime(4)+1) * prime(5) = 8 * 11 = 88.
		

Crossrefs

Programs

  • Maple
    A345727 := proc(n)
        (ithprime(n)+1)*ithprime(n+1) ;
    end proc:
    seq(A345727(n),n=1..10) ; # R. J. Mathar, Aug 16 2021
  • Mathematica
    (Prime@#+1)Prime[#+1]&/@Range@50 (* Giorgos Kalogeropoulos, Jul 23 2021 *)
    (#[[1]]+1)#[[2]]&/@Partition[Prime[Range[50]],2,1] (* Harvey P. Dale, Jan 08 2023 *)
  • PARI
    for(n=1, 100, print1((prime(n)+1)*prime(n+1), ", "))
    
  • Ruby
    require 'prime'
    values = []
    primes = Prime.first(20)
    primes.each_index do |n|
        next if n < 1
        values << (primes[n - 1] + 1) * primes[n]
    end
    p values

Formula

a(n) = A008864(n)*A000040(n+1).
a(n) = A180617(n)-A008864(n).
a(n) = A006094(n)+A000040(n+1).

A345366 a(n) = (p*q+1) mod (p+q) where p=prime(n) and q=prime(n+1).

Original entry on oeis.org

2, 0, 0, 6, 0, 12, 0, 18, 44, 0, 60, 36, 0, 42, 92, 104, 0, 120, 66, 0, 144, 78, 164, 78, 96, 0, 102, 0, 108, 192, 126, 260, 0, 264, 0, 300, 312, 162, 332, 344, 0, 348, 0, 192, 0, 170, 182, 222, 0, 228, 464, 0, 468, 500, 512, 524, 0, 540, 276, 0, 552, 552, 306
Offset: 1

Author

Simon Strandgaard, Jun 16 2021

Keywords

Comments

The graph of this function consists of three branches: the upper one corresponds to cases where q-p == 2 (mod 4) except the twin primes, the middle one to cases where q-p == 0 (mod 4), and the lower one (where a(n)=0) to cases where q-p = 2, the twin primes.
All terms are even.

Examples

			a(1) = ( 2* 3+1) mod ( 2+ 3) =   7 mod  5 = 2,
a(2) = ( 3* 5+1) mod ( 3+ 5) =  16 mod  8 = 0,
a(3) = ( 5* 7+1) mod ( 5+ 7) =  36 mod 12 = 0,
a(4) = ( 7*11+1) mod ( 7+11) =  78 mod 18 = 6,
a(5) = (11*13+1) mod (11+13) = 144 mod 24 = 0.
		

Crossrefs

Cf. A000040, A212769, A029707 (indices of 0's).

Programs

  • Maple
    a:= n-> ((p, q)-> irem(p*q+1, p+q))(map(ithprime, [n, n+1])[]):
    seq(a(n), n=1..63);  # Alois P. Heinz, Jul 03 2021
  • Mathematica
    Mod[#1*#2 + 1, #1 + #2] & @@@ Partition[Select[Range[300], PrimeQ], 2, 1] (* Amiram Eldar, Jun 16 2021 *)
  • PARI
    a(n)=my(p=prime(n), q=nextprime(p+1)); (p*q+1)%(p+q)
    
  • Python
    from sympy import nextprime
    def aupton(nn):
        alst, p, q = [], 2, 3
        while len(alst) < nn: alst.append((p*q+1)%(p+q)); p, q = q, nextprime(q)
        return alst
    print(aupton(62)) # Michael S. Branicky, Jun 16 2021
  • Ruby
    require 'prime'
    values = []
    Prime.first(21).each_cons(2) do |a, b|
        values << (a * b + 1) % (a + b)
    end
    p values
    

Formula

a(n) = A023523(n+1) mod A001043(n). - Michel Marcus, Jun 17 2021

A344348 a(n) = floor(frac(e * n) * n).

Original entry on oeis.org

0, 0, 0, 0, 3, 2, 1, 0, 5, 4, 1, 9, 7, 4, 0, 11, 7, 3, 16, 12, 7, 1, 17, 11, 5, 23, 17, 10, 3, 24, 16, 8, 31, 23, 14, 4, 30, 21, 11, 0, 29, 18, 7, 38, 26, 14, 1, 35, 22, 9, 45, 32, 18, 3, 42, 27, 12, 53, 38, 22, 5, 49, 33, 15, 62, 44, 26, 8, 57, 38, 19, 70
Offset: 0

Author

Simon Strandgaard, May 15 2021

Keywords

Examples

			x(n) = frac(e * n),
a(0) = floor(x(0) * 0) = floor(0.00 * 0) = 0,
a(1) = floor(x(1) * 1) = floor(0.72 * 1) = 0,
a(2) = floor(x(2) * 2) = floor(0.44 * 2) = 0,
a(3) = floor(x(3) * 3) = floor(0.15 * 3) = 0,
a(4) = floor(x(4) * 4) = floor(0.87 * 4) = 3.
		

Crossrefs

Cf. A001113, A342730 (uses primes, where this uses positive integers).

Programs

  • Mathematica
    Table[Floor[FractionalPart[E*n]*n],{n,0,80}] (* Harvey P. Dale, Jun 29 2025 *)
  • Ruby
    p (0..50).map {|n| (((Math::E * n) % 1) * n).floor }

A343496 First point of the straight lines in A340649.

Original entry on oeis.org

5, 31, 194, 1061, 6456, 40080, 251721, 1617206, 10553419, 69709769, 465769825
Offset: 1

Author

Simon Strandgaard and Jamie Morken, Apr 17 2021

Keywords

Comments

prime(a(n)+1) - prime(a(n)) = n*2. E.g., for n=4: prime(a(4)+1) - prime(a(4)) = 4*2, prime(1062) - prime(1061) = 4*2, 8521 - 8513 = 8.

Examples

			For n=1, consider k's with prime gap 1*2 = 2, i.e., k's such that A001223(k)=2. k=5 is the first place where A001223(k)=2 and A141042(k)=A340649(k), so a(1)=5.
For n=2, consider k's with prime gap 2*2 = 4, i.e., k's such that A001223(k)=4. k=31 is the first place where A001223(k)=4 and A141042(k)=A340649(k), so a(2)=31.
For n=3, consider k's with prime gap 3*2 = 6, i.e., k's such that A001223(k)=6. k=194 is the first place where A001223(k)=6 and A141042(k)=A340649(k), so a(3)=194.
		

Programs

  • Ruby
    n = 1
    last_prime = 2
    find_gap = 2
    result = []
    Prime.each(10_000) do |prime|
        next if prime == 2
        gap = prime - last_prime
        if gap == find_gap
            value = (n * prime) % last_prime
            if value == n * gap
                result << n
                find_gap += 2
            end
        end
        n += 1
        last_prime = prime
    end
    p result

Formula

a(n) = smallest k that satisfies A001223(k) = 2*n and A340649(k) = A141042(k).