12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- #!/usr/bin/ruby
- # a(n) is the smallest number k such that factorizations of n consecutive integers starting at k have the same excess of number of primes counted with multiplicity over number of primes counted without multiplicity (A046660).
- # https://oeis.org/A323253
- # See also:
- # https://oeis.org/A072072
- # https://oeis.org/A071125
- var range = @(1..100)
- func excess (n) {
- n.bigomega - n.omega
- }
- func score(n) {
- var t = excess(n)
- range.first_by {|k| excess(n+k) != t }
- }
- say score(80566783622) #=> 6
- say score(30199064929748) #=> 1
- say score(341249411050244) #=> 8
- say [844, 74849, 671346, 8870025, 254023231417746].map(score) #=> [4, 5, 6, 7, 8]
- __END__
- var n = 1
- for k in (1..1e5) {
- while (isok(k) >= n) {
- say "a(#{n}) = #{k}"
- ++n
- }
- }
- __END__
- \\ PARI code
- excess(n) = bigomega(n) - omega(n);
- score(n) = my(t=excess(n)); for(k=1, oo, if(excess(n+k) != t, return(k)));
- upto(nn) = my(n=1); for(k=1, nn, while(score(k) >= n, print1(k, ", "); n++)); \\ ~~~~
- __END__
- Factors of k+j for j = 0..7, where k = 341249411050244:
- [2, 2, 23, 23, 37, 10601, 411157]
- [3, 3, 3, 5, 717919, 3520973]
- [2, 19, 19, 19, 43, 15919, 36341]
- [7, 7, 7, 994896242129]
- [2, 2, 2, 3, 61, 211, 1104710237]
- [13, 13, 13, 155325175717]
- [2, 5, 5, 5, 31, 2591, 16994281]
- [3, 11, 11, 11, 1609, 53114923]
- Factors of k+j for j = 0..7, where k = 254023231417746:
- [2, 3, 7, 7, 7, 174431, 707627]
- [11, 11, 11, 863, 3329, 66431]
- [2, 2, 13, 13, 223, 1685085251]
- [3, 3, 3, 95857, 98148991]
- [2, 5, 5, 5, 9001, 112886671]
- [19, 19, 47, 47, 97, 3283967]
- [2, 2, 2, 3, 10584301309073]
- [7, 23, 23, 23, 599, 4979263]
|