Skip to content

Commit

Permalink
Update.
Browse files Browse the repository at this point in the history
  • Loading branch information
trizen committed Nov 10, 2024
1 parent ad8252f commit 27af3ed
Show file tree
Hide file tree
Showing 12 changed files with 497 additions and 1 deletion.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -550,6 +550,19 @@ Highly experimental personal projects.
* [Fermat pseudoprimes of the form p*((p-1)*n + 1)](./oeis-research/Daniel%20Suteu/Fermat%20pseudoprimes%20of%20the%20form%20p*((p-1)*n%20+%201))
* [prog.pl](./oeis-research/Daniel%20Suteu/Fermat%20pseudoprimes%20of%20the%20form%20p*((p-1)*n%20+%201)/prog.pl)
* [prog.sf](./oeis-research/Daniel%20Suteu/Fermat%20pseudoprimes%20of%20the%20form%20p*((p-1)*n%20+%201)/prog.sf)
* [First number k such that k + a(i) has n distinct prime factors, for all i < n](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20k%20+%20a(i)%20has%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n)
* [prog.sf](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20k%20+%20a(i)%20has%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n/prog.sf)
* [First number k such that k + a(i) is the product of n distinct prime factors, for all i < n](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20k%20+%20a(i)%20is%20the%20product%20of%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n)
* [prog.pl](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20k%20+%20a(i)%20is%20the%20product%20of%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n/prog.pl)
* [prog.sf](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20k%20+%20a(i)%20is%20the%20product%20of%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n/prog.sf)
* [First number k such that the concatenation of a(i) and k has n distinct prime factors, for all i < n](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20a(i)%20and%20k%20has%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n)
* [prog.sf](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20a(i)%20and%20k%20has%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n/prog.sf)
* [First number k such that the concatenation of a(i) and k has n prime factors, counted with multiplicity, for all i < n](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20a(i)%20and%20k%20has%20n%20prime%20factors,%20counted%20with%20multiplicity,%20for%20all%20i%20<%20n)
* [prog.sf](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20a(i)%20and%20k%20has%20n%20prime%20factors,%20counted%20with%20multiplicity,%20for%20all%20i%20<%20n/prog.sf)
* [First number k such that the concatenation of k and a(i) has n distinct prime factors, for all i < n](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20k%20and%20a(i)%20has%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n)
* [prog.sf](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20k%20and%20a(i)%20has%20n%20distinct%20prime%20factors,%20for%20all%20i%20<%20n/prog.sf)
* [First number k such that the concatenation of k and a(i) has n prime factors, counted with multiplicity, for all i < n](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20k%20and%20a(i)%20has%20n%20prime%20factors,%20counted%20with%20multiplicity,%20for%20all%20i%20<%20n)
* [prog.sf](./oeis-research/Daniel%20Suteu/First%20number%20k%20such%20that%20the%20concatenation%20of%20k%20and%20a(i)%20has%20n%20prime%20factors,%20counted%20with%20multiplicity,%20for%20all%20i%20<%20n/prog.sf)
* [Generalized class of primes](./oeis-research/Daniel%20Suteu/Generalized%20class%20of%20primes)
* [prog.sf](./oeis-research/Daniel%20Suteu/Generalized%20class%20of%20primes/prog.sf)
* [Incrementally largest numbers n that are the product of primes p such that p+1 divides n](./oeis-research/Daniel%20Suteu/Incrementally%20largest%20numbers%20n%20that%20are%20the%20product%20of%20primes%20p%20such%20that%20p+1%20divides%20n)
Expand Down Expand Up @@ -1080,6 +1093,8 @@ Highly experimental personal projects.
* [is squarefree omega prime.sf](./oeis-research/J.W.L.%20(Jan)%20Eerland/Least%20prime%20p%20such%20that%20p^n%20+%204%20is%20the%20product%20of%20n%20distinct%20primes/is_squarefree_omega_prime.sf)
* [Least prime p such that p^n + 6 is the product of n distinct primes](./oeis-research/J.W.L.%20(Jan)%20Eerland/Least%20prime%20p%20such%20that%20p^n%20+%206%20is%20the%20product%20of%20n%20distinct%20primes)
* [is squarefree almost prime.sf](./oeis-research/J.W.L.%20(Jan)%20Eerland/Least%20prime%20p%20such%20that%20p^n%20+%206%20is%20the%20product%20of%20n%20distinct%20primes/is_squarefree_almost_prime.sf)
* [Smallest k such that 3^(4*3^n) - k is a safe prime](./oeis-research/J.W.L.%20(Jan)%20Eerland/Smallest%20k%20such%20that%203^(4*3^n)%20-%20k%20is%20a%20safe%20prime)
* [prog.sf](./oeis-research/J.W.L.%20(Jan)%20Eerland/Smallest%20k%20such%20that%203^(4*3^n)%20-%20k%20is%20a%20safe%20prime/prog.sf)
* [Jacques Tramu](./oeis-research/Jacques%20Tramu)
* [First odd prime in the (n-th)-order Fibonacci sequence Fn](./oeis-research/Jacques%20Tramu/First%20odd%20prime%20in%20the%20(n-th)-order%20Fibonacci%20sequence%20Fn)
* [prog.pl](./oeis-research/Jacques%20Tramu/First%20odd%20prime%20in%20the%20(n-th)-order%20Fibonacci%20sequence%20Fn/prog.pl)
Expand Down Expand Up @@ -1643,6 +1658,9 @@ Highly experimental personal projects.
* [First k such that if x(1) = k and x(i+1) = A062028(x(i)), x(1) to x(n) are all semiprimes but x(n+1) is not](./oeis-research/Robert%20Israel/First%20k%20such%20that%20if%20x(1)%20=%20k%20and%20x(i+1)%20=%20A062028(x(i)),%20x(1)%20to%20x(n)%20are%20all%20semiprimes%20but%20x(n+1)%20is%20not)
* [prog.pl](./oeis-research/Robert%20Israel/First%20k%20such%20that%20if%20x(1)%20=%20k%20and%20x(i+1)%20=%20A062028(x(i)),%20x(1)%20to%20x(n)%20are%20all%20semiprimes%20but%20x(n+1)%20is%20not/prog.pl)
* [prog 2.pl](./oeis-research/Robert%20Israel/First%20k%20such%20that%20if%20x(1)%20=%20k%20and%20x(i+1)%20=%20A062028(x(i)),%20x(1)%20to%20x(n)%20are%20all%20semiprimes%20but%20x(n+1)%20is%20not/prog_2.pl)
* [First number k such that k + a(i) has n prime factors, counted with multiplicity, for all i < n](./oeis-research/Robert%20Israel/First%20number%20k%20such%20that%20k%20+%20a(i)%20has%20n%20prime%20factors,%20counted%20with%20multiplicity,%20for%20all%20i%20<%20n)
* [prog.pl](./oeis-research/Robert%20Israel/First%20number%20k%20such%20that%20k%20+%20a(i)%20has%20n%20prime%20factors,%20counted%20with%20multiplicity,%20for%20all%20i%20<%20n/prog.pl)
* [upperbounds.pl](./oeis-research/Robert%20Israel/First%20number%20k%20such%20that%20k%20+%20a(i)%20has%20n%20prime%20factors,%20counted%20with%20multiplicity,%20for%20all%20i%20<%20n/upperbounds.pl)
* [First number that is the sum of k successive semiprimes for 1 <= k <= n](./oeis-research/Robert%20Israel/First%20number%20that%20is%20the%20sum%20of%20k%20successive%20semiprimes%20for%201%20<=%20k%20<=%20n)
* [prog.pl](./oeis-research/Robert%20Israel/First%20number%20that%20is%20the%20sum%20of%20k%20successive%20semiprimes%20for%201%20<=%20k%20<=%20n/prog.pl)
* [prog memory friendly.pl](./oeis-research/Robert%20Israel/First%20number%20that%20is%20the%20sum%20of%20k%20successive%20semiprimes%20for%201%20<=%20k%20<=%20n/prog_memory_friendly.pl)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/ruby

# a(n) is the first number k such that k + a(i) has n distinct prime factors, for all i < n; a(0) = 0.
# https://oeis.org/A??????

# Known terms:
# 0, 2, 10, 130, 8930, 1133900, 401424520

func a(n) is cached {

return 0 if (n == 0);
var terms = (^n -> map(a).flip)

var lo = 1
var hi = 2*lo

loop {
n.omega_primes_each(lo, hi, {|k|
if (terms.all { is_omega_prime(k + _, n) }) {
return k
}
})
lo = hi+1
hi = 2*lo
}
}

for n in (1..10) {
say [n, a(n)]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
#!/usr/bin/perl

# a(n) is the first number k such that k + a(i) is the product of n distinct prime factors, for all i < n; a(0) = 0.
# https://oeis.org/A??????

# Known terms:
# 0, 2, 33, 1309, 55165, 13386021, 2239003921

# Lower-bounds:
# a(7) > 1649267441663, if it exists.

use 5.036;
use ntheory qw(:all);

my @terms = (0, 2, 33, 1309, 55165, 13386021, 2239003921);

sub squarefree_almost_prime_numbers ($A, $B, $k, $callback) {

$A = vecmax($A, powint(2, $k));

my $n = $k;

sub ($m, $p, $k) {

if ($k == 1) {

my $v;

forprimes {

$v = $m * $_;

if ( is_almost_prime($n, $v + $terms[-1])
and is_almost_prime($n, $v + $terms[-2])
and is_almost_prime($n, $v + $terms[-3])
and is_square_free($v + $terms[-1])
and is_square_free($v + $terms[-2])
and is_square_free($v + $terms[-3])
and vecall { is_almost_prime($n, $v + $_) and is_square_free($v + $_) } @terms) {
$callback->($v);
$B = $v if ($v < $B);
lastfor;
}

} vecmax($p, cdivint($A, $m)), divint($B, $m);

return;
}

my $s = rootint(divint($B, $m), $k);

foreach my $q (@{primes($p, $s)}) {
__SUB__->($m * $q, $q+1, $k - 1);
}
}
->(1, 2, $k);
}

my $n = 7;
my $lo = 2;
my $hi = 2 * $lo;

say "\n:: Searching for a($n)\n";

while (1) {

say "Sieving: [$lo, $hi]";

my @terms;
squarefree_almost_prime_numbers(
$lo, $hi, $n,
sub($k) {
say "Found upper-bound: a($n) <= $k";
push @terms, $k;
}
);

@terms = sort { $a <=> $b } @terms;

if (@terms) {
say "New term: a($n) = $terms[0]\n";
last;
}

$lo = $hi + 1;
$hi = 2 * $lo;
}

__END__
Sieving: [805306367, 1610612734]
Sieving: [1610612735, 3221225470]
Found upper-bound: a(6) <= 2239003921
New term: a(6) = 2239003921
perl prog.pl 28.40s user 0.04s system 92% cpu 30.751 total
Sieving: [824633720831, 1649267441662]
Sieving: [1649267441663, 3298534883326]
^C
perl prog.pl 6250.60s user 14.21s system 84% cpu 2:03:41.07 total
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/ruby

# a(n) is the first number k such that k + a(i) is the product of n distinct prime factors, for all i < n; a(0) = 0.
# https://oeis.org/A??????

# Known terms:
# 0, 2, 33, 1309, 55165, 13386021, 2239003921

func a(n) is cached {

return 0 if (n == 0);
var terms = (^n -> map(a).flip)

var lo = 1
var hi = 2*lo

loop {
n.squarefree_almost_primes_each(lo, hi, {|k|
if (terms.all { is_squarefree_almost_prime(k + _, n) }) {
return k
}
})
lo = hi+1
hi = 2*lo
}
}

for n in (1..10) {
say "a(#{n}) = #{a(n)}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/ruby

# a(n) is the irst number k such that the concatenation of a(i) and k has n distinct prime factors, for all i < n; a(0) = 0.
# https://oeis.org/A??????

# Known terms:
# 0, 2, 6, 66, 210, 22110, 9958740

func a(n) is cached {

return 0 if (n == 0);
var terms = (^n -> map(a).flip)

var lo = 1
var hi = 2*lo

loop {
n.omega_primes_each(lo, hi, {|k|
if (terms.all { is_omega_prime(Num(join('', _, k)), n) }) {
return k
}
})
lo = hi+1
hi = 2*lo
}
}

for n in (1..10) {
say "a(#{n}) = #{a(n)}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/ruby

# a(n) is the irst number k such that the concatenation of a(i) and k has n prime factors, counted with multiplicity, for all i < n; a(0) = 0.
# https://oeis.org/A??????

# Known terms:
# 0, 2, 6, 8, 152, 920, 2256, 57824, 223520, 612500, 14103168, 110125568

func a(n) is cached {

return 0 if (n == 0);
var terms = (^n -> map(a).flip)

var lo = 1
var hi = 2*lo

loop {
n.almost_primes_each(lo, hi, {|k|
if (terms.all { is_almost_prime(Num(join('', _, k)), n) }) {
return k
}
})
lo = hi+1
hi = 2*lo
}
}

for n in (1..100) {
say "a(#{n}) = #{a(n)}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/ruby

# a(n) is the irst number k such that the concatenation of k and a(i) has n distinct prime factors, for all i < n; a(0) = 1.
# https://oeis.org/A??????

# Known terms:
# 1, 3, 14, 804, 48330, 16579170

func a(n) is cached {

return 1 if (n == 0);
var terms = (^n -> map(a).flip)

var lo = 1
var hi = 2*lo

loop {
n.omega_primes_each(lo, hi, {|k|
if (terms.all { is_omega_prime(Num(join('', k, _)), n) }) {
return k
}
})
lo = hi+1
hi = 2*lo
}
}

for n in (1..10) {
say "a(#{n}) = #{a(n)}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/ruby

# a(n) is the irst number k such that the concatenation of k and a(i) has n prime factors, counted with multiplicity, for all i < n; a(0) = 1.
# https://oeis.org/A??????

# Known terms:
# 1, 3, 9, 555, 18762, 1516626

func a(n) is cached {

return 1 if (n == 0);
var terms = (^n -> map(a).flip)

var lo = 1
var hi = 2*lo

loop {
n.almost_primes_each(lo, hi, {|k|
if (terms.all { is_almost_prime(Num(join('', k, _)), n) }) {
return k
}
})
lo = hi+1
hi = 2*lo
}
}

for n in (1..100) {
say "a(#{n}) = #{a(n)}"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/ruby

# Smallest k such that 3^(4*3^n) - k is a safe prime.
# https://oeis.org/A376946

# Known terms:
# 22, 202, 6934, 634, 109678, 445294, 2323138

# Lower-bounds:
# a(7) > 23348433

func a(n, from=1) {

var prefix = 3**(4 * 3**n)
var len = prefix.len

for k in (from .. Inf) {
say "Testing: #{k} (length: #{len})"

local Num!USE_PFGW = false

if (primality_pretest(prefix - k) && primality_pretest((prefix - k - 1)>>1)) {

local Num!USE_PFGW = true

if (prefix - k -> is_safe_prime) {
return k
}
}
}
}

var n = 7
var from = 23348433

say "a(#{n}) = #{a(n, from)}"

#for n in (0..100) {
# say [n, a(n)]
#}

__END__
[0, 22]
[2, 6934]
[3, 634]
[4, 109678]
[5, 445294]
[6, 2323138]

Testing: 14194858 (length: 4174)
^C
/home/swampyx/Other/Programare/sidef/bin/sidef -N prog.sf 20260.40s user 1064.73s system 95% cpu 6:13:50.82 total
Loading

0 comments on commit 27af3ed

Please sign in to comment.